Tunneling remote control

Continuing with my May 3 entry, I managed to establish remote control via both VNC and Remote Desktop through my SSH tunnel. It’s pretty simple once you get through the conceptual hurdles and set a new registry key value for VNC.

The process is only a little different depending on whether you’ve got 2 machines in the equation (your controlling machine and your controlled machine) or 3 machines (your controlling machine, a intermediary machine to which you SSH, and the controlled machine).

For the TWO machine case, ssh from your controlling machine to the controlled machine like so:

  ssh -L <localport>:localhost:<remoteport> controlled-machine

For the THREE machine case, ssh from the controlling machine to the intermediary machine like so:

  ssh -g -L <localport>:localhost:<remoteport> intermediary-machine

&ltremoteport&gt for Remote Desktop should be 3389 and for VNC it’s 5900 (or 5901 or 5902, etc., depending on your Display Number setting in VNC’s options).

&ltlocalport&gt is the port number on the controlling machine (the local machine) that you’ll connect to with either Remote Desktop or vncviewer.

OK, so, now you need to connect. Connecting is a little different depending on whether you’ve got the two machine or the three machine case.

In the TWO machine case, for VNC use the following. And if you get an error message about local loopback being disabled, read WinVNC – Advanced Settings and set the registry key appropriately.

  vncviewer localhost:<displaynumber>

Remote Desktop won’t let you connect to localhost so enter in the Computer Name field.

In the THREE machine case, for both vncviewer and Remote Desktop you use the hostname of the machine to be controlled.

Simple, eh? OK, maybe not really simple but it’s not as hard as it looks. Work through it once or twice and everything should become clear. And here’s a link to the RealVNC web page that explains how to use SSH.

BTW, an alternative if the only machines in the picture are running Windows, is UltraVNC.

Leave a Comment