VNC is useful for accessing a remote graphical desktop.

Here’s a simple configuration for RedHat Enterprise Linux 5.

Customize VNC for a user

# su - user
% vncpasswd
% vi .vnc/xstartup
% chmod 755 .vnc/xstartup

With an example of .vnc/xstartup

#!/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 &

Configure the VNC server

# vi /etc/X11/xorg.conf

Insert the following :

Section "Screen"
        Option "SecurityTypes" "None"
EndSection

Section "Module"
        Load "vnc"
EndSection

Configure and restart iptables

# vi /etc/sysconfig/iptables

Insert the following :

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT

Restart iptables :

# service iptables restart

Enable and start vncserver

# vi /etc/sysconfig/vncservers

Insert the following :

VNCSERVERS="1:user"
VNCSERVERARGS[1]="-geometry 1280x960"

Start VNC server :

# chkconfig vncserver on
# service vncserver start