Thursday, January 28, 2010

VNC Access on Ubuntu or Redhat

I typically use shell access on all my linux servers but sometimes I need to load X and use GNOME or KDE in either Ubuntu or Redhat/Fedora/Cent OS. The problem is  that the vncserver file resides in different places depending upon the distribution you are using. I like to modify the vncserver file to increase the resolution of the virtual server to match my 20” monitor.

Ubuntu:
/etc/alternatives/vncserver

edit the global variable to tweak the vncserver resolution.
$geometry = "1280x1024";

Redhat/Fedora/Cent OS:
/etc/sysconfig/vncservers

Different variables to tweak how the vncserver daemon runs. Tweak the variable below to adjust the resolution.
VNCSERVERARGS[2]="-geometry 1280x1024"

Read the comments at the beginning of each distributions vncserver file for other settings and tweaks.

Want KDE or GNOME to load when your virtual terminal loads. Then you need to edit the .xstartup file for the user that the vncserver will run as.
For instance if you login to your linux box with “Fred” then you need to go to edit the xstartup file in the .vnc folder in your home directory. I like the joe editor but vi works also.

vi /home/fred/.vnc/xstartup

make sure this is at the end of the file for GNOME
exec gnome-session &

or
for KDE use the following
startkde &

If you see
twm &
you will need to either remove it or comment it out.
#twm &

Enjoy

No comments:

Post a Comment