In Mac OS X 10.4 Tiger, you could use Finder (GUI) to mount an SMB mount which was being tunneled through ssh
For example:
- From Terminal establish the tunnel:
ssh -L 139:remote_machine:139 user@remote_machine
- Then, in Finder, Go ? Connect to Server…
- In “Server Address”, smb://localhost/mountpoint
However, this doesn’t work in Mac OS X 10.5 Leopard anymore!
The workaround is instead of using Finder, to use the mount_smbfs command in Terminal:
mount_smbfs //samba_user_name@localhost/samba_share /local/mount/point/
For example:
After establishing the tunnel (see above), I first made a mount point:
cd ~; mkdir sambamount
Then mounted it:
mount_smbfs //samba_user_name@localhost/data ~/sambamount
Once mounted, you should see the volume appear on your desktop, and you can drag it to the trash (or use ‘umount’) to unmount it.
**** UPDATE 25 Mar, 2009 ****
I’m getting many hits for this post, so I’m adding a little more detail for my setup specifically.
My work blocks almost all ports to incoming traffic. In order to log into a machine from the outside (for example from my home computer) I must first ssh into a firewall computer and setup a tunnel, or can ssh or telnet to another computer (you can do nothing on the firewall computer except ssh or telnet).
So, here’s my setup for tunnelling the SMB traffic within a ssh session (and still mount via Finder):
home <-ssh/tunnel-> firewall.example.com <-smb traffic-> smb_server.example.com
My work account credentials are the same on both the firewall computer and the SMB server.
You can add your modified version of the following to the file ‘/Users/mac_username/.ssh/config’:
#------------------------------------------------------ # For mounting smb shares locally from home: #-- This is the name of this alias to this specific # configuration: Host smb_tunnel_from_home #-- Work's firewall computer (can also use IP number here) Hostname firewall.example.com #-- In place of 'work_username', your firewall username goes # here: User work_username #-- 127.0.0.2 is your computer, the second (where there are # x's) is the SMB server. Seems like I have to use the IP # number (instead of smb_server.example.com for this!): LocalForward 127.0.0.2:139 xxx.xxx.xxx.xxx:139 LocalForward 127.0.0.2:445 xxx.xxx.xxx.xxx:445 #------ TO USE: ------ #--Using Terminal, at the prompt type (this creates an alias # of 127.0.0.1 at 127.0.0.2): # sudo ifconfig lo0 alias 127.0.0.2 up #--Now start the ssh session: # sudo ssh work_username@smb_tunnel_from_home \ # -F /Users/mac_username/.ssh/config #--Then, in finder, Go->Connect to Server (Cmd-K), in the # box type: # smb://127.0.0.2/work_username #--In the box which pops up, enter your work_username # and work_password. #--Be sure to unmount the volume in finder when done using. #------------------------------------------------------