From Department of Statistical Science Computing Wiki
Jump to: navigation, search

Using different desktop sessions in VNC

This page describes how to configure your VNC session to use a different desktop manager. The default manager in VNC is very lame and old-fashioned and lacks most modern desktop enhancements.

The ~/.vnc/xstartup file

The ~/.vnc/xstartup file controls what programs are run when you start a VNC server session. It is a simple sh script, and by default looks like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

It does the following things:

  • Run a default xstartup file (/etc/vnc/xstartup) if it exists.
  • Loads your X Resources file ($HOME/.Xresources) if it exists
  • Sets the background of the desktop grey
  • Starts the vncconfig program in the background. This is a utility that provides cut-and-paste between your VNC session and the computer you are running the VNC viewer on, and a couple other things.
  • Starts an xterm program
  • Starts the twm window manager.


Making your VNC session more user friendly requires editing this file slightly to start a different window manager system. You have three options: Gnome, KDE, and XFCE4. Gnome and KDE are the two major contendors in the desktop environment, while XFCE4 provides a more lightweight experience that is better than plain old twm but not as taxing on the computer as Gnome or KDE.

Any time you make changes to your xstartup script you will need to terminate and restart your VNC server session to activate the changes.

Setting up Gnome

To use the Gnome desktop environment, edit your ~/.vnc/xstartup file to look like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec gnome-session

This will start the Gnome desktop environment.

Setting up KDE

To use the KDE desktop environment, edit your ~/.vnc/xstartup file to look like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec startkde

This will start the KDE desktop environment.

Setting up XFCE4

To use the XFCE4 desktop environment, edit your ~/.vnc/xstartup file to look like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec startxfce4

This will start the XFCE4 desktop environment.