How to Access Files on a Firewalled Windows Server from a Mac using SSH

Problem:

You have a Mac OS X computer at home, and you want to access transparently your files on a Windows server at work that's behind the company firewall. The only available access to the company side of the firewall is via SSH to a Linux server.

Solution:

  1. On the Mac,
    • as administrator, download and install Macfusion2. Restart.
    • as regular user, using Macfusion2, set up and mount a folder mountpoint on the Linux server.

  2. On the Linux server,
    • set up a shell script connect.windows.server containing
      #!/bin/bash
      OPTIONS="user=xxxx,password=xxxx,gid=users,file_mode=0644,dir_mode=0755,domain=XXXXX"
      /sbin/umount.cifs mountpoint 2> /dev/null > /dev/null
      /sbin/mount.cifs //server/share mountpoint -o $OPTIONS
    • Place the script connect.windows.server in your PATH and make it executable.

Now running Macfusion in your Mac will set up a network drive containing your Linux server files, and running in the Mac the shell command ssh linux.user.name@linux.server connect.windows.server will show your windows server files within the aforementioned network drive.