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


# Uncomment the following two lines for normal desktop:
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"

Section "Module"
        Load "vnc"

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 :

VNCSERVERARGS[1]="-geometry 1280x960"

Start VNC server :

# chkconfig vncserver on
# service vncserver start