This tutorial is based on CentOS 7.0 server, so you should set up a basic CentOS 7.0 server installation before you continue with this tutorial. 

Installation Start:

Step 1: Yum install Services

yum install vnc-server xorg-x11-fonts-Type1 xinetd

Step 2: Add User

useradd user1  
passwd user1  

useradd user2
passwd user2 
exit

Step 3:Enable the XDMCP.

vi /etc/gdm/custom.conf

Add the following content.

[security]

AllowRemoteRoot=true

DisallowTCP=false




[xdmcp]

Enable=true

MaxSessions=30

Step 4: Create Xinetd service.

vi /etc/xinetd.d/vncserver

Place the following content on the above file.

service vncserver

{

disable = no

socket_type = stream

protocol = tcp

group = tty

wait = no

user = nobody

server = /usr/bin/Xvnc

server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none

}

Step 5:Create VNC service.

vi /etc/services

Add the following line at the end of file.

vncserver 5900/tcp # VNC and GDM

Step 6:Restart xinetd service

systemctl restart xinetd.service

Step 7: netstat (network statistics)

netstat -ntlp | grep vnc

It will showing up the network statistics like below :

Step 8: IPtables Rules

Set the iptables rules only to a single user login, and the second user login, you must wait until the first user logout, to be able to log in.

iptables - A INPUT -p tcp -m tcp --dport 6002 -j DROP

You can expect the user number and block by + the port number 6003,600x

Share to your friends if you found out this article is useful.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *