There are numerous articles describing tunnelling Samba over SSH with putty. In this post I will show you how to set up Samba tunnelling for everyday use without putty running all the time.
Things you need before you start:
An SSH server between you and the shares you want to connect to. It may be running on the same machine as the shares you want to access.
Also, File Sharing (Windows) or Samba (Linux) should be configured correctly on the machine you want to access. Make sure your firewall lets the SSH server connect to your Samba or Windows shares.
Step 1: Create a local loopback interface
We need to create a loopback interface on your local computer first. There is a lot of HOWTOs on the web describing this. I suggest you read this one. As soon as you have the loopback working and putting properly forwarding ports to the local loopback interface, go to step 2.
Step 2: Set up the tunnelling app
So you have the forwarding working now. Technically, that’s all you need. However, if you plan to use shares on a daily basis, there are a few things you will notice:
- It’s annoying to have the putty window open all the time,
- If you close it, your shares will become unavailable,
- If your network goes down for a while, putty won’t be able to reconnect your ssh session.
There’s a solution to these problems: a tunnelling tray application. Personally, I like myentunnel. It’s a simple wrapper for plink.exe from the putty package. Sitting quietly in the task-bar’s tray, it’s unobtrusive and reconnects automatically after a network failure.
Install and run myentunnel. Then set your hostname, username and password stuff in the Settings tab and go to the Tunnels tab. Add the Samba port and IPs in the Local box, press Save and then Connect. If putty connected and forwarded the ports properly, myentunnel should work without a hitch too.
If you have multiple servers to connect to, you can create server profiles. Read the myentunnel documentation for details.
That’s all, enjoy.