In Approach, we have servers (ya, rly!). From time to time I need to access them. Usually, I do this by connecting to our VPN. At times, however, that is not possible, like for instance when some overzealous firewall administrator has blocked outgoing PPTP. Then you might have the need for an alternate approach, like using an SSH tunnel (provided that the administrator didn’t block outgoing SSH as well…)
And yes, I am aware that there are plenty of guides how to setup an SSH tunnel with Putty, but I found that they are either 1) overly verbose, 2) not exactly describing my problem or 3) wrong.
The situation
- I want to access a Windows Server using Remote Desktop
- There is a Linux server running in the same network section. Mine is running Ubuntu, so all examples will be in Ubuntuish.
- I have a Windows 7 client machine, with the Putty ssh client
On the Linux server
- Make sure that SSH is installed (it probably is, otherwise, how do you access the server?). If not,
$ sudo apt-get install ssh
. - Edit /etc/ssh/sshd_config.
Check that it says AllowTcpForwarding yes somewhere. If not, add it. - Reload sshd.
$ sudo /etc/init.d/sshd reload
or$ sudo service ssh reload
depending on your Ubuntu version.
On the Windows client
- If you don’t have Putty yet, get it.
- Configure putty to connect to your Linux server using SSH 2.
- Under Connection – SSH – Tunnels, map a local port to remote desktop on your Windows server. Usually, the remote port is 3389. The local port can be anything, except 3389 or 3390, which won’t work*.
- Save the session and connect to your linux server. You need to log on, and keep the connection open.
- Open a remote desktop session to the source port on localhost.
- Profit.
* Because 3389 is probably already running a RDP server, and 3390 is blocked in Windows 7 for some reason.