Controlling a Computer Remotely with VNC

And check out FileChucker while you're busy VNC-ing!

VNC is a program (well, two programs, a client and a server) that lets you control one computer from another over a network, like the internet.  You get a window on the client, and inside that window, you see the desktop of the server, and you can control its mouse and keyboard.  Of course, you configure the server with a password (and ideally, connect to it through SSH), so that only people who you WANT to control your system can do so.

VNC is free, and you can download it for MS Windows and Linux, among others.  You can control a Windows system from Linux or vice-versa; it's platform independent.

I installed the VNC server on a Windows 2000 system, and was able to connect to it and control it from VNC clients (or "viewers") on Windows XP and Slackware Linux 9.0.  And it was very simple to set up, even with all my systems being behind firewalls.  I roughly followed these instructions about SSH (local copy) and these instructions about Advanced Options (local copy) for running the server on Windows.  But I'll explain everything I did on this page; I only provided those pages for reference.

Setting Up the Server

  1. Install OpenSSH for Windows on the server.  Note that you must create a username and password for this (the installation instructions will guide you through it), and you must also create a Windows user account on the server with the same username/password.  If your computer is connected to the internet through a router/firewall, and/or you have a firewall program installed on your system, you need to configure it/them to pass port 22 through to this computer.

  2. Download and install the Windows binary version of VNC on the server.  When it prompts you, tell it to install as a service.  (If you're using Windows 9x/ME you might not get this option.)  When you get to the configuration screen, set the display number to 01, and make sure you set a password.

  3. Click Start, Run, then type regedit and press Enter.  Create a new DWORD called "AllowLoopback" at HKEY_LOCAL_MACHINE\SOFTWARE\ORL\WinVNC3\, and give it a value of 1.  While you've got the regeditor open, check out the Advanced Options here and set any that you want to set.  Close the regeditor when you're done, then restart the VNC server.  You can do that by right-clicking on its icon in the system tray, by using the shortcuts on the start menu, or by typing "net stop winvnc" then "net start winvnc" at the command prompt.

Setting up the Client(s)

I set up VNC using SSH tunneling, because it's much more secure than going without it, and because it's also really easy.  Even when both client and server are behind firewalls, you only need to open one port (22) on one firewall (the server's).  And since SSH can use compression, it can actually make your VNC connections faster.

So this means there are actually two clients that you run: the SSH client and then the VNC client, which goes through the SSH connection.

Setting up a Linux Client

On Linux, you already have a nice command-line SSH program, so you just need to download the Linux VNC client and install it.  Once it's installed, open a console window and type:
ssh -l <ssh-username> -L 5902:localhost:5901 <windows server IP or hostname> (Enter).  Enter your SSH (Windows-user) password, and you're in.  Then type vncviewer localhost:5902 (Enter).  Enter your VNC password, and the remote desktop should pop right up.

Setting up a Windows Client

  1. Download and install either the PuTTY SSH Client (if you want a windowed client) or the OpenSSH Client (if you want a command-line client) on the client AKA viewer machine.

  2. Download and install the Windows binary version of the VNC Client on the client machine.

  3. If you installed the OpenSSH client, then you log in to the SSH server by typing:
    ssh -l <ssh-username> -L 5902:localhost:5901 <windows server IP or hostname> (Enter).  Enter your SSH (Windows-user) password when prompted.

  4. If you installed the PuTTY SSH client, then run it, enter the IP address or hostname of the server to connect to, click on "SSH" (not Telnet or the others), and then go down to the "Tunnels" section.  Enter 5902 as the source port and localhost:5901 as the destination, and click the "Local" option (not Remote).

    Then click on the Add button:

    Finally, click on Open to start the SSH connection.  Enter your SSH (Windows user) username and password to log in.

  5. Once logged in to the SSH server, you can minimize/forget about that window.  Then run the VNC client program, and tell it to connect to localhost:5902.  Enter the VNC password, and the remote desktop should pop right up.