8.13. Using VNC to Control Windows from Linux

You want to control your Windows workstation or server remotely from your Linux box. Or, you want to be able to remotely control user's Windows PCs for helpdesk chores or remote administration.

Virtual Network Computing (VNC) is just what you need. There are several variants of VNC; in these recipes, we'll use TightVNC. VNC has two parts: the server and the client (which is called the viewer).

Install the TightVNC server and the DFMirage driver on Windows (see TightVNC, http://www.tightvnc.com/).

Install any VNC viewer on Linux. Chances are, one is already installed by default. The TightVNC viewer includes a Java viewer, so any Java-enabled web browser can be a VNC viewer.

The Windows installer will take you through a number of steps. The main question is, do you want TightVNC to run as a service or in application mode? You can change this at any time with the "Install VNC Service" or "Remove VNC Service" commands. Use application mode for occasional use, and run it as a service for frequent use.

These configuration options are important:

  • On the Server tab, be sure to enable Accept Socket Connections.

  • Make sure there are passwords for Primary Password and View-Only Password. Passwords may not be more than eight characters.

  • On the Administration tab, check Disable Empty Passwords.

  • To enable using a web browser as a client, check Enable built-in HTTP server.

  • Enable logging; it's not necessary to turn on debugging unless you're having problems.

Now, you can connect from any VNC viewer on any operating system by entering the IP address or hostname of the Windows box. Figure 8-6 shows the Xvnc4viewer login screen.

You may use any VNC-capable viewer, like the KDE Remote Desktop Connection, the Gnome remote desktop, jtightvncviewer, vncviewer, or xvnc4viewer.

To close out your remote session, just close the window.

To open a VNC session in a web browser, type [hostname-or-IP-address]:5800" in the address bar.

Please note that all transmissions are sent in the clear, and authentication is weakly protected, so you do not want to use this over untrusted networks.

On Debian, the TightVNC Java viewer is a separate package, tightvnc-java.

You can encrypt a VNC session by tunneling VNC over SSH (see Recipe 8.21). This works on any platforms that support SSH and VNC.

Unlike rdesktop, VNC works for any version of Windows.

Because the TightVNC server has its own password, you can log in to any active Windows session; it doesn't matter which Windows user is logged in.

In application mode, you need a Windows user already logged in on the Windows PC to enable remote logins. When it's running as a service, you don't.

Only Windows users with administrative privileges can make any changes to the TightVNC server configuration when it runs as a service. This prevents remote users from shutting down the VNC server or changing its settings.

When the TightVNC server runs in application mode, then any Windows user can run it as they please, and remote users can change VNC settings, and even shut it down. This is a nice convenience for users, and also a potential security hole.