The University of Arizona

6.5. Setting Up Your VNC Service

Math IT SupportRemote Access to Math AccountsSetting Up Your VNC Service

After updating your xstartup file, make sure execute permissions are set on it:
bobburton@chivo:~/.vnc$ ls -ld xstartup
-rwxr-xr-x 1 bobburton users  24 Feb 13 10:35 xstartup
Kill your current VNC server process if you have one:
bobburton@chivo:~/.vnc$ ps -ef | grep vnc | grep bobburton
bobburt+ 24506 1 0 08:57 pts/8 00:00:00 Xvnc4 :2 -desktop chivo:2 (bobburton) -httpd /usr/share/vnc-java -auth /u5/bobburton/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /u5/bobburton/.vnc/passwd -rfbport 5902 -pn -fp /usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
bobburton@chivo:~/.vnc$ vncserver -kill :2
Killing Xvnc4 process ID 24506
bobburton@chivo:~/.vnc$
Restart the VNC server:
bobburton@chivo:~/.vnc$ vncserver -geometry 1680x1000 -depth 24
Found /usr/share/vnc-java for http connections.

New 'chivo:2 (bobburton)' desktop is chivo:2

Starting applications specified in /u5/bobburton/.vnc/xstartup
Log file is /u5/bobburton/.vnc/chivo:2.log

bobburton@chivo:~/.vnc$

  • Many warnings will be spewed to the log file, e.g. ~/.vnc/chivo1:2.log, but none prevent the desktop from running.

How to reset your vnc password

Use ssh to connect to any networked linux machine (e.g.  phoenix, dragon or a chivo) and enter the command "vncpasswd." You will be prompted for a new password.

How to figure out your desktop number

If you've forgotten your desktop number, you can connect to the VNC host via ssh then issue the command:

ps -ef | grep vnc | grep myusername

How to permanently kill your remote desktop

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

To kill all your desktops at once, use the command:

killall Xvnc4 

You can ignore any "Operation not permitted" error messages.

Advanced VNC Hints

  • The simpler the graphics on your desktop, the less information needs to be transferred, and the faster your VNC connection will be.       
    • Change your desktop background color to a solid color. Use solid white or solid black.
    • Simplify your desktop theme to one that uses rectangular windows, and uses a solid color (as opposed to gradient shading) for controls, window titles, etc.
    • Turn off any graphics, like moving charts or eyeballs that follow the mouse cursor...
  • To make VNC it as fast as possible you can use a smaller desktop, and use fewer bits per pixel. For example: vncserver -depth 8 -geometry 800x600.
  • When you create your VNC server with the command vncserver, you can use a different resolution and/or color depth. You can match your vnc screen resolution to that of your home computer and 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. (see "man vncserver" for more info.)
    • 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!
  • Please disable the screensaver on your remote desktop. (Otherwise your virtual desktop will use too many CPU cycles "saving" a non-existent screen.) On our remote desktop gateways, 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).

connect  to the server