Friday, February 13, 2009

VNCServer Configuration

In the ~/.vnc/xstartup we can configure vnc session to start in gnome or kde, as shown below:
#!/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" &            
/usr/dt/bin/dtwm &
#startkde &

unset DBUS_SESSION_BUS_ADDRESS; gnome-session &
Then start vnc server as:
$ vncserver 
This will tell you the hostname:sessionnum and set the password:

$ vncpasswd
Optionally you can change the screen size for your session as:
vncserver :displaynum -geometry 1920x1080
Now you are all set to connect with your favorite vnc client (i use ultravnc).

For XFCE desktop change the xstartup file to:
#!/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" &             

x-window-manager &
startxface4 &
exec /usr/bin/xfce4-session

No comments: