Tuesday, October 9, 2012

Setup CentOS / Redhat as a VNC server for all users


Lets suppose you have a Linux server you would like the users to access via VNC. On a basic setup a user may need to SSH into the server and find out what display socket they will be connecting to. This is overhead that can be avoided. Using the method below a user can connect directly to the server using a VNC client as their first and only step.


Open the ports:
vi /etc/sysconfig/iptables
Add the following lines
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5900 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5901 -j ACCEPT

Restart the firewall service:
service iptables restart

Be sure vnc-server and other components are installed:
yum –ty install vnc-server xinetd

Also grab vnc-ltsp-conf and install it using:
rpm –Uvh vnc-ltsp-config-4.0-4.el5.noarch.rpm

Start the services and configure to start on reboot:
service vncserver start

Check the service configuration in webmin or using system-config-services or using these commands:
/sbin/chkconfig xinetd on
/sbin/chkconfig vncts on
/sbin/chkconfig vncserver on
/sbin/service xinetd restart

Configuration:
As root edit the file "/etc/gdm/custom.conf"
To the next blank line below the "[security]" section add "DisallowTCP=false"
To the next blank line below the "[xdmcp]" section add "Enable=true"
Make sure you are in a position to either run "gdm-restart" for default Gnome installs or just reboot the CentOS box.

Valid users should now be able to use the VNC client to connect to the server.

3 comments:

  1. Can you tell how to login as root into the VNC remote session created as mentioned above?

    ReplyDelete
    Replies
    1. You should get the normal logon screen prompt.

      Delete

Let us know if you found anything helpful, or have an even better solution. Thanks for your participation in the discussion.