Setting up VNC with SSH

VNC is becoming a popular piece of software for remote desktop functionality. It has a client/server architecture: a computer must run a VNC server to offer its desktop for use elsewhere on the Internet, and a VNC client must be started and connected to a VNC server to start using that desktop.

VNC has a weak security system: it allows arbitrary passwords to be used and doesn't encrypt them over the network. Therefore, it is better to use VNC in combination with SSH. This is done as follows.

The screenshots (click on them to enlarge) show possible configurations for the two SSH clients mentioned before. VNC/X display numbers n correspond to TCP/IP network ports 5900+n, so normally you woul tell SSH to map port 5900 to remote port 5900, 5901 to 5901, and perhaps a few more. In this configuration the port numbers are shifted by 10, so if the remote VNC server is running on display :1, the local VNC client must connect to localhost:11 to access it. This allows me to still use ports :0 and :1 for other purposes, such as a local VNC server, an Exceed X server, or a Cygwin X server.

VNC servers on MS Windows

In this setup it is assumed that the VNC server runs on a Unix or Linux machine. However, VNC can just as well be used to connect to a Microsoft Windows system, if a VNC server is running there. The same considerations apply there: it is safer to restrict such a VNC server to local connections and use SSH to connect to it remotely.

However, this requires that a SSH server is running on the Windows machine. There are many ways to obtain such a beast; one is to use the one distributed with Cygwin. Configuring it to run, however, requires some arcane text file editing; see this somewhat related e-mail message for details.

Why stop here?

At work (and for my hobbies, too) I need to execute different tasks on different computer systems, whenever one system offers facilities (hardware properties or devices, OS capabilities, access to certain applications, services or files) that the other doesn't. For ideal convenience everything should be accessible from anywhere in the world, as long as some computer with an Internet connection is available there. Owing to tools such as VNC, for the things I do with computers this is effective reality today.

The previous screenshots already provided a reminder that VNC is just one out of a plethora of options for doing similar things. The following screenshot carries things even further over the top.

It shows the following computers and OSes in action:

Some similar tools, such as coLinux and Microsoft Unix Services for Windows, which has functionality similar to Cygwin, are also installed but do not appear in the screenshot.

See also

Colophon

This document was written by Reinier Post. Please report any problems, suggestions or improvements regarding this subject or this document back to me.

Thank you.