The most recent version of this document can always be found at http://www.nunswithguns.co.uk/Samba-with-SSH.sgml
I began writing this HOWTO because I had to spend far too long figuring it all out myself and I could find no existing HOWTO or tutorial on this subject. I found a few posts to mailing lists from frustrated users but nothing recent and most of the posts I did find were left unanswered. This HOWTO attempts to deal with setting up Samba to use an SSH tunnel. Specifically it deals with setting up a directory on your local linux pc which uses smbmount to connect to a remote windows share where the two computers use an SSH tunnel to 'bounce' through a server in-between them. Also included in this HOWTO are details of how to get an interactive login using smbclient through an SSH tunnel and how to use smbclient in a way suitable for shell scripts.
This document leads you through the different steps needed to set up Samba over SSH
The environment I have been setting up is like this:
-------------- ((INTERNET)) ---------------- | | (local network) (remote network) | | [ linux_1 ] [ linux_2 ] ------------- [ windows_server ]
In this example, I want to have a local directory on linux_1 (/mnt/windir) that is a smb mounted folder connected to the windows server. The windows server will ONLY talk to the linux_2 server on the remote network. it will not talk to any machine on the Internet. (We don't trust windows enough for that) . So we have to set up an SSH tunnel from a local port on linux_1 to connect to windows_server through SSH on linux_2.