Monthly Archives: May 2012

Using Microsoft Remote Desktop over an SSH Tunnel

This assumes you are on a Windows machine trying to remotely login to a Windows machine, but you need to use an SSH tunnel to get through the firewall.

The overall idea is that you set up a port on the local computer to forward all traffic to a port on the remote computer. Then you use remote desktop to “remote” into the _local computer_, but because the traffic gets forwarded, you actually connect to the remote one. The one little catch is that Windows doesn’t think you should remote desktop to your own computer, so you can’t just use “localhost”, instead you can use, which will still route to the localhost, but won’t register to remote desktop as a circular reference.

1. Download and run putty.exe.

2. On the “Session” tab (the default one)
Under the Host Name, put:
Leave the Port at 22, and the connection type at SSH

3. Click the “Connection” tab on the side, and drill down to SSH and “Tunnels”

4. Under “Source Port”:
(yes it is a little box, but put in this whole IP address).
This is an IP address that will map to the “local host” ip address, but because it’s not just “localhost” Windows will not “detect” the circular reference and let it through when you try to do the remote desktop. The port 3389 is the default port for remote desktop.

5. Under “Destination”, put the IP address you want to connect to (ie, the static internal IP address of the computer as if you were inside the network.)
So this will be something like

6. Go back to the session tab.
In the Saved Sessions box, type: “rd port forward” or something like that, and click “Save.”
Then for future use, you can simply select this session and have everything set up.

7. Click “open” and supply your account password. This will log you into a standard SSH session, but in addition, it will be forwarding traffic on port 3389 to the supplied one.
Leave this SSH window open in the background while you remote desktop in.

8. Run Remote Desktop.
(I click Start -> Run, and then type “mstsc” (Microsoft terminial services client) to run it.)
Under the computer name type: “”
Again this will refer to “localhost” but then putty will redirect this port to the one on the remote computer.

9. Login to the remote computer and enjoy!