Saturday, September 18, 2010

VCN: 2nd (and subsequent) ubuntu gnome desktops

Often when remote accessing the gnome desktop of a linux machine, the physical desktop of the local machine is not necessarily the one that you want use. eg there is already a user on that desktop, or the resolution of the local monitor is often too large for comfortable vnc use.

So: in addition to using the gnome 'remote desktop' feature (which uses vinagre btw), install in addition vnc4server:
apt-get install vnc4server
when using a vnc viewer, the default display (:0) will be accessed when you run:
vncviewer
when vnc4server is additionally installed running the command
vncserver
will start up a 2nd desktop accessible thus:
vncviewer 192.168.1.1:1
each time the command is run another desktop is set running; the desktop number increments each time, as does the port number (desktop:0 starts at 5900 by default)
The type of desktop is setup in the file: ~/user/.vnc/xstartup and by default the twm type desktop is not much help.
To edit the xstartup file (using nano) so that it will start up a regular gnome desktop add 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" &

unset SESSION_MANAGER
sh /etc/X11/xinit/xinitrc

If you've just edited the above and had previously set a desktop:1 running, stop it with:
vncserver -kill :1
then start the server again. When accessing this time you should have a regular gnome desktop.

Sometimes I've had trouble using the gnome desktop over VNC, whereby the menus don't show/dropdown on the client machine. Changing the 'appearance' setting to visual enhancements = none (under system-> preferences) on the server side has usually sorted this.

No comments: