How to Tunnel Remote Desktop

Through SSH on a Windows Computer



Tunneling via ssh from one windows machine to another requires two additional items other than the windows machines themselves. You need an ssh client to run on the home machine, and you need a host to act as a gateway for the ssh session.

Setting up PuTTY

  1. Start PuTTY (double-click on putty.exe). You will see a window similar to this one:


    Notice the port number of the host. CEMR IT uses port 2222 instead of the default 22 for ssh.


  2. Next, enable compression. Select SSH protocol level 2 as the default in the SSH subcategory for better security.

  3. Configure the "tunneling". In the example below, we are tunneling the remote desktop port on the local machine, through the gateway host to the Remote Desktop port on the remote server "myWindowsMachine.dnsname.wvu.edu" (enter the name or IP address of your computer in place of this name). The name is resolved from the remote gateway machine, so it can be a hostname not visible to the user machine. Depending on your operating system, what you enter into "Source Port" may be different from the example shown:

    *For more information on why this is necessary, see this page

  4. Go back to the Session subcategory, identify the gateway host's IP address or name (in the example below we used cemrweb.cemr.wvu.edu as the gateway, although it could be any computer with ssh allowed through the firewall), make sure that the SSH button is filled, name your session (in this case "Tunnel to my Remote Desktop") and save it:


    Whenever you need the tunnel to appear, you can start PuTTY and double-click that session.

Starting Remote Desktop


  1. Start PuTTY and then click on the session that you saved earlier;  this will start the SSH connection.

  2. Login to the gateway computer when prompted (in this case, the gateway computer is 'cemrweb.cemr.wvu.edu') and when the login process is done, you can minimze the active PuTTY session (you don't need to type anything more, but you need to keep the program running).

  3. Start your Remote Desktop program as usual.  Instead of entering the name of the computer that you want to connect to, you must type in the address and port that Putty is forwarding to. Depending on your operating system, this may be different from what is shown in the example:

    This will connect you to the computer that was specified in PuTTY.


  4. Voila! You are now connected to your Remote Desktop computer through an SSH tunnel!

  5. After you are done using Remote Desktop, exit from the program as normal and then you may close the PuTTY program.