Port Forwarding RDP with PuTTY

You can use PuTTY, which is a free implementation of Telnet and SSH clients for Windows and Unix platforms to log into a system via SSH and by using the SSH port forwarding functionality that PuTTY provides, establish a Remote Desktop Protocol (RDP) connection through a "tunnel" you establish via the SSH connection.

The remote SSH server could be a Microsoft Windows system running SSH server software, such as OpenSSH for Windows, CopSSH, WinSSHD, etc. or it could be a Unix, Linux, Mac OS X system, etc.

To configure the local system on which you are running PuTTY for port forwarding an RDP connection, take the following steps in PuTTY:

  1. Load the PuTTY SSH session you wish to configure, if you wish to add the RDP tunnel permanently to the configuration for a saved session.
  2. Click on the "+" to the left of "SSH" in the left pane of the window to display the list of options beneath it.
  3. Click on "Tunnels".
  4. In the Source port field, put a port number that will be opened on the system on which you are running PuTTY, i.e., the "local" end of the tunnel. You could use port 3389, which is the port normally used for RDP connections, but I usually specify another unused port, in case the system on which I'm running PuTTY is already listening for RDP connections itself. E.g., you could 4389 for the source port value. For the Destination field, put 127.0.0.1:3389, if the remote system to which you wish to establish the RDP connection is using the default RDP listening port. Then click on the Add button

    If, however, the SSH server to which you are connecting isn't the system to which you wish to establish the RDP connection, then instead of the local loopback address, 127.0.0.1, use the address of the system to which you wish to connect via RDP, e.g., 192.168.0.6:3389, if you wish to have the remote SSH server forward the RDP traffic it receives to another system.
  5. If you are configuring a session for which you wish to make this tunnel a permanent feature, click on Save to save the session.

You can now establish the SSH connection to the remote system. Once the SSH session is established, you then act as if you are establishing an RDP connection to the system on which you are running PuTTY, but when you do so the RDP connection is port forwarded to the remote SSH server, which if it is the target RDP server will respond to the RDP connection or if it in turn was configured to forward the RDP connection to another system, e.g., in the case above where the RDP server was at 192.168.0.6, will forward the RDP connection from itself to that other system.

Let's say rather than using the default port of 3389 for RDP on the system running PuTTY I used port 4389. If I wanted to connect to the console of the remote RDP server from a command line, I could use the mstsc command available at the command prompt on Microsoft Windows XP and later systems to establish the connection as shown below:

mstsc /admin /v:127.0.0.1:4389

Note: if you are unfamiliar with the mstsc command, you can type mstsc /? at a command prompt to see the options available for it. Use /admin when you are running the command from a Windows XP system to establish a connection to the console session of a server, but if you run the mstsc command from Windows Small Business Server 2003 system, use /console, instead of /admin. In both cases you use /v:127.0.0.1, because you need to establish a connection to the local system from which you established the PuTTY SSH connection. Put a colon and the port number you used for the source port in PuTTY after the 127.0.0.1, e.g. 127.0.0.1:4389. The port number is for the local system and it will get translated to the port number you used in the Destination field in PuTTY, which would be 3389 if the remote RDP server is listening on the default RDP port.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Friday May 18, 2012