Getting started with VNC
What is VNC?
VNC is often described
as "remote desktop" software. Essentially, a familiar Linux desktop runs
in a virtual screen sitting in memory on our remote desktop gateway, and
you can
"connect to" or "view" or "remotely control" (all the same thing)
that virtual desktop from anywhere in the world. In particular, you
can do so from machines running Mac OS X or Microsoft Windows.
(For the curious: you can read more about this project at
www.realvnc.com
and at www.tightvnc.com.
The TightVNC folks have the faster implementation.)
One-time setup: starting a VNC server
To get started, you must once and for all create your virtual X desktop.
-
Pick a computer to be your VNC host.
We have two computers
set aside specifically for this purpose:
-
Use SSH to connect to the VNC host. You can simply click the host name above
to invoke the java-based SSH client, or more generally you can use any
other SSH client, as explained on our
remote shell access page.
To verify that you are not being duped by a rogue gateway, the first time
you try to connect you will be presented with the gateway's
RSA or DSA key fingerprint. The correct fingerprints are:
bobcat (RSA): b1:be:86:f4:5d:25:52:ec:1d:65:a3:fc:c6:39:e8:f0
bobcat (RSA/Babble): xikar-besad-nulac-rozul-ganas-tosis-rocet-cyben-nirev-fakep-huxix
bobcat (DSA): b2:d4:19:92:c8:7e:00:1a:2b:06:63:02:21:10:45:35
bobcat (DSA/Babble): xidad-mysum-midyh-vycer-lidoc-sotok-vyhef-pegar-pylyz-myrug-vyxix
iguana (RSA): f5:a6:0c:7a:bf:62:0e:7e:6c:44:b2:2c:2f:73:2a:b8
iguana (RSA/Babble): xerap-tocyt-vodut-firel-kiduf-dusyz-bedob-nocup-bymyt-soroh-hoxux
iguana (DSA): d6:2f:2e:e6:b0:68:1e:7e:9a:e9:50:27:13:9c:90:fe
iguana (DSA/Babble): xiket-kulis-dityd-rifac-nikiv-pades-dyfut-nyraz-zekyp-recyd-nexax
-
Optional step: If you've run VNC in the past, use the command
killall Xvnc Xrealvnc
to eliminate other remote desktops owned by you.
Ignore the various “Operation not permitted” error messages,
which refer to remote desktops owned by other people.)
-
Optional step: If you've run VNC in the past and you can no longer
remember your VNC password, eliminate your existing VNC servers
(see previous step) and then remove the file .vnc/passwd.
You will be prompted for a new password when you follow the instructions
below to create your VNC server.
-
Optional step: If you've run VNC in the past and these instructions
lead to an unfamiliar X environment, eliminate your existing
VNC servers (see prior steps) and then remove the file
.vnc/xstartup. Appropriate defaults will be used when
you follow the instructions below to create your VNC server.
-
Use the command vncserver to create your remote desktop.
It will tell you the number of your new desktop. It might be ":7", or ":13".
You must remember that number!
(Advanced users might also want to specify additional options to
the vncserver command, to control the pixel depth and
desktop resolution. See the bottom of this page for more information
on that.)
-
Your remote desktop is now created. You can close the text-only SSH
connection, and use a VNC viewer to connect to your
remote desktop.
How to figure out your desktop number
If you've forgotten your desktop number, first use SSH to connect
to the VNC host, as described above, then issue the command
ps -ef | grep vnc to get a list of all desktops.
You can even issue ps -ef | grep vnc | grep myusername
to restrict the output to lines containing your username.
How to permanently kill your remote desktop
There is seldom a need to do this. To kill your remote desktops, first use
SSH to connect to the VNC host, as described above. To kill a particular
desktop, for example desktop number 7, use the
command vncserver -kill :7; or, to kill all your
desktops at once, use the command
killall Xvnc Xrealvnc.
(Ignore the various “Operation not permitted” error messages,
which refer to remote desktops owned by other people.)
Hints for getting the most out of VNC
-
The simpler the graphics on your desktop, the less information needs to be
transferred, and thus the faster your VNC connection will be.
- Change your desktop background color to a solid color. Even better,
use solid white or solid black.
- Simplify your desktop theme to one that uses rectangular (as opposed to
rounded) windows, and uses a solid color (as opposed to gradient shading)
for controls, window titles, and other adornments.
- Turn off any cutesy things, like moving charts that monitor CPU usage,
or eyeballs that follow the mouse cursor...
-
If you are connecting over dial-up,
then you want to streamline your VNC to make it as fast as possible. In
addition to the notes above on simplifying your desktop, also use
a smaller desktop, and use fewer bits per pixel. For example:
vncserver -depth 8 -geometry 800x600.
-
When you created your VNC server with the command
vncserver, you could have specified a different resolution and/or
color depth. You might want to have this information precisely match the
screen from which you most often use VNC, and then run your VNC viewer
in fullscreen mode.
- For example, say your Windows box at home has a display resolution
of 1280x1024 at 24 bits/pixel. (To see this information,
right-click on the background of the desktop
and bring up Properties.)
- When you create your VNC server, you could use the command
vncserver -depth 24 -geometry 1280x1024. (The manpage has
complete documentation: man vncserver.)
- When you connect from your Windows box, right-click on the titlebar
of the outermost VNC window and select "Full Screen". It will tell you the
keystrokes to escape from full-screen mode.
- At this point, instead of seeing Linux inside a VNC window inside
Microsoft Windows, all you see in front of you is your remote Linux desktop!
-
Finally, be sure to disable the screensaver on your remote desktop.
(Otherwise your virtual desktop will eat up all the CPU cycles "saving"
a non-existent screen.) On our two remote desktop
gateways bobcat and iguana, the screensaver has already been
disabled—but if you run a VNC server on some other computer,
then the first time you connect to your remote desktop, disable
your X screensaver (go to Start/Programs/Settings/Desktop/Screensaver).