Remote Control With VNC

Once you have your network set up, it's useful if you can control everything from one place. I access my Linux servers from the Windows PC on my desk. If you do things this way, you can run the servers without monitors and keep them somewhere out of the way.

You can use telnet. To connect to a Linux PC which has address from your Windows PC, select start/run, type


into the open: box and hit the OK button. This will open up a frame that looks like a UNIX command window. It will display a login prompt. Type your user name and it will ask for your password. Supply that and you are logged in, and you can type commands.

For security reasons, you cannot log in as root this way, so you need to have created another user account. (It's good practice to do this anyway.) Once you are logged in, you can use su to become root.

The settings on the telnet window don't match the ones Linux expects, so the connection is a bit flaky. It's enough to do simple tasks, like shutting down the computer.

You get a much better connection using the the Virtual Network Computing (VNC) software. This turns your Windows PC into an X-Windows terminal, so you have all the advantages of the windowing environment that you get when you log into the Linux PC from its own keyboard - you can run a browser, start up extra command windows and so on. You can also use VNC to control a Windows PC from a Linux PC, a Windows PC from another Windows PC, or whatever.

Download VNC from You will need the VNC viewer for your Windows PC and the VNC server for your Linux PC. It comes with installation instructions.

When you connect from a VNC viewer to a VNC server, you are logged in as the user who started the server. You can start a VNC server as root, but that's not good practice, as it gives root access to your PC across the network.

Once you have your Linuc PC stashed away somewhere, you need to connect to it via telnet and start the VNC server. Then you can run the VNC viewer on your PC. When you run the viewer, use the Linux PC's IP address as the server name. You can run many copies of VNC, so you also have to give it a session number, something like:

Each session runs continuously. If you close the viewer and then run run another one, you will be logged in where you left off. You will see the same terminal windows containing the same text as before.

To clear down your logged-in session, shut down the VNC server. You should always do this before you shut down the Linux computer. The VNC server software creates a control file when it starts up and it has to be closed down cleanly, otherwise it will use a different session number and print confusing error message the next time you run it. I haven't tested it, but I suspect that it may eventually run out of session numbers. In any case, the left-over control files will gradually fill up your disk.

To shut down the VNC server, exit from the viewer, go back to your telnet window, use ps to find out the process id of the VNC server and kill it. To find the process id, use ps:

	 $ ps -aux | grep vnc
	 simon      611  0.3 14.1  3632 2040 pts/0    S    11:26   0:11 Xvnc :1 -desktop
	 simon      686  0.0  2.7  1148  396 pts/0    S    12:23   0:00 grep vnc

	 $ kill -TERM 611

This finds two processes. We are interested in the first - vncserver starts up a program running called Xvnc. In this case it is process number 611. We want to get that to tidy up its control files and shut down cleanly. The kill command tells it to do that.

Now you can use su to become root, and shut down the Linux PC.