[HOW TO] install x11vnc on CentOS 6/ CentOS 7

Few weeks ago I received the requirement from developer when he need to remote control to server on company.

I talked him: please wait me a minutes
And then, I installed x11vnc on server. You was familiar with x11vnc, if you didn't also nothing. On this article I will show you how to install x11vnc? how to implement it?

Firstly you need to install x11vnc from repositories as below:
yum search x11vncyum install x11vnc.x86_64

After that, you need to create x11vnc file in path /etc/xinetd.d/x11vnc
vim /etc/xinetd.d/x11vnc
service x11vnc
{
port = 5900
type = UNLISTED
socket_type = stream
protocol = tcp
wait = no
user = long
server = /usr/bin/x11vnc
server_args = -inetd -o /home/long/log/x11vnc.log -display :0 -auth /var/gdm/:0.Xauth -passwdfile /home/long/.vncpasswd -many -bg
disable = no
}
You can see that I defined the display, vncpasswd, background or foreground service running. You also change it by your way.

And then, you start xinetd
service xinetd start

Okay, now you have a x11vnc service. Next, importantly, I set the x11vnc's password. At least It helps me to prevent the victim to remote ours server.
bozo@dev01  ~  x11vnc -storepasswd ~/.vncpasswd  
Enter VNC password:
Verify password:  
Write password to /home/bozo/.vncpasswd?  [y]/n y
Password written to: /home/bozo/.vncpasswd
bozo@dev01  ~  -rw------- 1 long long 8 Jul 10 20:46 /home/long/.vncpasswd 
ls -lrt
-rw------- 1 bozo bozo 8 Jul 10 20:46 /home/bozo/.vncpasswd 

So how to vnc?
You need to ssh to x11vnc's server, and run following command line:
bozo@dev01  ~  x11vnc -rfbauth ~/.vncpasswd

On developer computer, we install VNC viewer/ client. And now they can access server by the information:
vnc server: IP/ DNS:5901
[IP server]:[VNC Port]

Please notice you don't kill terminal above step to keep session VNC.

Finally the developer inputs the VNC's password to authenticate.

Tiến Phan - R0039

Knowledge is Endless

Sharing for Success