Wednesday 8 August 2007

Forwarding Remote Desktop Connection via SSH

A problem: there's a remote Windows machine A which you need to access. You don't have direct access to that machine, however, you can SSH to some server B which does have access to A.

Solution: since Remote Desktop Connection uses single port 3389 for connection, it is just possible to make local SSH forwarding of, say, your port 3389 to the A:3389. Then use your Remote Desktop Connection client to connect to localhost (assuming that you don't have RDserver running on your current machine), and you are done. Right? Not always.

For me, the solution above worked if my current machine was a linux box. Also, I know some people, for whom this solution worked on Windows machines too. But for me, the scenario above produced complaint from standard Windows Remote Desktop Connection client:

The client could not connect. You are already connected to the console of this computer. A new console session cannot be established.

I've found the solution for this problem here. The idea is that if you use putty as your SSH client, the current version allows to bind local ports not just to localhost (127.0.0.1), but also for something like 127.0.0.2 (127.*.*.*). The configuration of putty connection should look like this (substitute target for the name of your machine):


Now, the connection configuration for RDC client must look like that:


Well, that's all. You should be able to connect to machine A now from your Windows box.

No comments: