Thursday, October 3, 2002

RDP through SSH

Remote Desktop Protocol (RDP) or Terminal Services is a method of logging into a Windows XP Pro or Windows Server box. Unlike VNC where you control the console, with RDP, you get your own session. Terminal Servers can have many users connected at once. It is possible to tunnel an RDP session through an SSH connection.

In order to initiate the secure connection, you'll need to connect with SSH:
ssh -T -L 3390:myrdpserver:3389 -C -N username@mysshserver

To break this down,

  • The "-T" tells SSH not to allocate a tty for shell related activities. This is an optional parameter.

  • The "-L 3390:myvncserver:3389" tells SSH to forward port 3390 on the local machine to port 3389 on myvncserver.

  • The "-C" tells SSH to employ compression. This is additionally useful because RDP also does not employ compression. This is an optional parameter.

  • The "-N" tells SSH not to execute a shell or commands. Since your purpose here is to connect via RDP, you don't really need the SH part of SSH here. ;-) This is an optional parameter.
Next, you'll want to start your RDP client and connect to localhost:3390. At that point, you will be prompted with the Login dialog box. Enter your username and password and go on your way. When you're done, log off from RDP the way you normally would. Now, press "[Ctrl]+C" in the window where you started SSH to end the SSH connection.

NOTE: If you're using Windows XP Pro, the Remote Desktop Connection application will complain about connecting to localhost because you are (possibly) running a terminal server locally.