Remote VNC Connections - Make it easy for users

February 25th, 2009 Do you often need to help friends or family with their Windows system? Something broken on their system and talking them through is just totally impossible? Well probably you like this then. Let them install VNC, e.g. RealVNC. There is a free edition, so make sure they don't install something else.

After that the only thing they need to do is right click on that VNC logo in the Statusbar and select Add remote client. That option is really neat. It lets the user open a reverse connection to an given IP/Port combination, so all that trouble with their firewall or router doesn't matter anymore.

Of course to make things work you need to give them a valid URL or IP combination so that they can connect to. e.g. mydomain.com:5500.

I myself sit behind a NAT'd and routed connection which makes direct connections no good. So I often just SSH tunnel myself to a remote machine for this purpose. The magic to make this happen is that you open two consoles, one for your vnc and another one for your tunnel.

The commands you will need are

The first command basically just opens a vncviewer application in listen mode for inbound connections. The second one is a simple reverse tunnel to the machine at user@mydomain.com where every connection to port 5500 is sent back to my machine. Of course this will only work if you are allowed to do that and if the firewall on mydomain.com is not configured to do something else with :5500 traffic.

Voila! Your user can connect to your connection allowing you to solve their problems more quickly, saving you alot of nerve.

If you are like me and you still like to save more keystrokes, maybe this screen config will come in handy.

% cat bin/screenvncsessionconfig 
screen -t "ssh" 1 ssh -Nv -R 0.0.0.0:5500:localhost:5500 user@mydomain.com
screen -t "vncviewer" 2 vncviewer -listen


For your e.g. Zsh config use this:

% which remotevnc
remotevnc: aliased to ssh-add; screen -S vnc -c /home/br/bin/screenvncsessionconfig


Good Luck !