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): 2c:a0:e2:ac:71:09:02:a6:96:0a:ce:07:8b:21:f0:16
    bobcat (RSA/Babble): xuvaz-duzen-tovef-gugem-benam-rycih-hogah-sucig-tafik-lifif-vexix
    bobcat (DSA): f2:2b:a3:79:db:c7:8c:f7:2b:cc:58:96:65:db:f4:8b
    bobcat (DSA/Babble): xisoc-hodec-ruhad-sozud-saput-neneg-vivod-tuvir-rasev-sofor-hoxyx
    
    iguana (RSA): d2:4b:5c:61:15:58:5a:27:84:34:22:e8:de:43:55:b1
    iguana (RSA/Babble): xemic-lybyz-curop-tokac-mukyz-bibal-cogos-lumik-cecan-bimih-paxax
    iguana (DSA): 92:0c:c2:25:cc:3b:c4:10:ad:f9:77:1f:2a:01:fb:16
    iguana (DSA/Babble): xutek-buluf-boduk-moret-cadid-giheh-zecat-hymir-hikum-cemim-cyxyx
    
  • 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).

Department of Mathematics
The University of Arizona
617 N. Santa Rita Ave.
P.O. Box 210089
Tucson, AZ 85721-0089 USA
Voice: (520)621-6892
Fax: (520)621-8322

http://math.arizona.edu
Maintainer: webmaster@math.arizona.edu
Validate: XHTML, CSS

© Copyright 2003-10 Arizona Board of Regents
All rights reserved.