linux setup notes
Compiling and running VNC in Linuxby T.J. Nelson
NC is a remote control application that sends the display, mouse, and keystrokes to a remote computer. (Not all keystrokes are transmitted—if you type Ctrl-Alt-Delete, for instance, it reboots your local PC instead of the remote one.) It's particularly useful in communicating between Linux and Windows machines.
This document describes how to set up Tight VNC 1.3.9 on a Linux server.
There are several different kinds of vnc out there with different ways of configuring them. I prefer to compile it myself, so I can use the same one on both newer and older computers.
Some versions of vnc use a file in
This has the advantage of only needing to start a single copy of Xvnc, which
is running as root. The vncservers file looks like this:
VNCSERVERS="1:bruce 2:lance 3:steve"
Other versions ignore this file. For these versions, each user starts a separate copy of Xvnc and leaves it running continuously. This may be a little safer, but is less scalable. Typically this second scheme would be used if all your Windows users log in on the same shared account. The second version is described here.
Xvnc is started using the
vncserver, which is a script that needs
to be edited.
vncpasswdto create the ~/.vnc directory and default startup files for that user.
/home/bruce/.vnc/xstartup. This file is comparable to the ~/.xinitrc file for X11. The last line is their window manager. My xstartup file looks like this:
xsetroot -solid grey
/usr/bin/urxvt -geometry 100x35+100+100&
/usr/bin/urxvt -geometry 100x35+100+200&
#$fontPath = "unix/:7100";
$fontPath = "/usr/share/fonts/,/usr/share/fonts/misc,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/";
su bruce; vncserver :1They will be logged in as the person who started the vncserver, so if you're using this type of vnc, you need to be careful not to start vncserver as root.
su lance; vncserver :2
su steve; vncserver :3
This procedure might seem strange since you can't connect to X11 using vncviewer
(e.g., by typing
VNC is not really an X server; they use entirely different protocols. It is only
sending a copy of the display.
X11 doesn't even have to be running in order to use Xvnc, so if the server is on a
text-mode command line Xvnc still gives you a graphical desktop. But X11 has to be
installed, and of course the files you include in your
exist. So you could use it as a cheap KVM switch if you want. With a fast enough
network, there's no reason not to.
vncserver -kill :1. This kills the remote for one single user.
-interface your-ip-address. This is an essential feature: if you have a public and a private interface, you want to block the public one to avoid getting scanned by IT or by outsiders. IT will accuse you of running a web server, which is not a good thing to happen in a corporate environment, so it's best to turn off or block this function.
vncviewer. In Linux, you can specify the user with the
-user usernameoption. In Windows, there is no way to specify the username as far as I can tell. This means your users must have the same username on the server as on their Windows PCs.
I'm a big fan of this program. It eliminates the expense and hassle of trying to get an X11 running on a Windows machine. We use vnc on all our HPLC instruments, so we can watch the data from our desk as it appears. We can start a new sample or stop the machine remotely if a problem occurs without having to run down the hall trying to get through all those damn security doors.
When you run it in Windows, it even puts anything you select into the clipboard of the local PC, so you don't even have to transfer files from one PC to another.