Configuring VNC Server For Multiple Users

* VNC Server allows sysadmin to administer the server in GUI environment provided the server is able to boot up in run level 5. We are setting up 2 users for vnc access in this instance.
* If not already done, install vnc server.

yum install vnc-server

* In /etc/sysconfig/vncservers

VNCSERVERS="1:user1 2:user2"
VNCSERVERARGS[2]="-geometry 1280x1024"
VNCSERVERARGS[3]="-geometry 1280x1024"

* Manually switch between users and run vncpasswd. Assuming you are root.

su - user1
vncpasswd
// repeat for x number of users

* Open up the vnc ports in the firewall. The vnc ports start from 5901. So if I have 5 users, the port range is from 5901 to 5905

-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 tcp -p tcp --dport 5902 -j ACCEPT

* restart firewall and vncserver

service iptables restart
service vncserver restart

* (optional) To allow users to have access to the Gnome interface. Go to the user’s home directory

vim ~/.vnc/xstartup

* Uncomment these 2 lines

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Restart the vncserver again.
* All done. Test it out!

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.