VNC Antics

VNC is generally pretty straight forward and easy to use. But once in a while I need to do something quirky with it.

Tunneling VNC

If it hasn't happened already, at some point you will need to VNC into a box that is behind a firewall or router that you have no control of and therefore, cannot open up the appropriate ports. Use an ssh tunnel:

ssh -g -L 5901:localhost:5901 username@yourvncbox

And then to log into it you would login as though you were vnc'ing to your local machine:

vncviewer localhost:1

The 5901 is the default port that vnc uses for the first desktop. However, if when you started your vncserver it said that your desktop was something like :3, then the port would be 5903.

Speeding up VNC

Depending on your distrobution, the default compression of Tight VNC is ZLib. Which ensures that it will be compatible with other versions of VNC. However, even on a broadband connection, this is not very fast. You can change the compression algorithm it uses. Along with some other tweaks you can get it to go very fast:

vncviewer -encodings Tight -compresslevel 9 -quality 0 -nocursorshape vncbox:1

Coupled with starting the server with only 8 colors:

vncserver -depth 8