SMB connection over SSH

At one point, I wanted to connect from my MacBook Pro (using OS X Leopard 10.5.1)  to our OS X server’s Samba shares from off campus.  The only problem is that the server only allows SSH connections off campus.  This is all you need, however, to create a tunnel and connect to the windows shares.   To create the tunnel, do

 sudo ssh user@servername -L localhost:139:servername:139 

The next part involves mounting the share, which Leopard won’t let you do from the Finder (it gives the error message “This file server is running on your machine. Please access the volumes and files locally.” )  That’s ok, you can get around this by opening the terminal and typing the following commands:

  1. sudo mkdir /Volumes/sharename 
  2. sudo mount_smbfs //username:password@localhost/sharename /Volumes/sharename

 Note that in my case I wanted to have a subdirectory on the share mounted, so in place of command 2 above, I typed (all one line):  

sudo mount_smbfs //username:password@localhost/sharename/subdir /Volumes/sharename  

 

And it worked!  I then used this share to do my backup using Time Machine.  Time Machine will let you backup to network shares if you type the following at the terminal (all one line):

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1″  

 

3 thoughts on “SMB connection over SSH”

  1. you’ve got to connect the phacops pro connection. The take the tripple spacer and put it in the blue soccet. Now connect the flux capasiter and it is critical that you not forget the crystals. Now put the T handle between your legs and plug it in. Then you will be connected!

  2. If you put sudo in front mount_smbfs for me it would give me something about not having sufficient privledges (I think it mounts the moutpoint with ownership as root rather your user?), anywho, I don’t think the sudo is necessary for mount_smbfs and maybe for others, like me, it will actually mount it the way it should so you can browse it.

  3. It is necessary to use sudo if you are making a directory outside of your home directory, in which case you would also need sudo to mount the volume. But it is good to know you can get by without it.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.