No Persistent mode:
apt-get update && upgrade apt-get install x11vnc x11vnc -storepasswd
x11vnc -ncache 10 -auth guess -nap -forever -loop -repeat -rfbauth /root/.vnc/passwd -rfbport 5900 -noncache
Persistent mode:
Step:01
Go to the below path cd /usr/local/bin
Step:02
and create the file nano sharex11vnc
Step:3
Enter the following,
#!/bin/sh x11vnc -ncache 10 -auth guess -repeat -nap -loop -forever -rfbauth ~/.vnc/passwd -desktop "VNC ${USER}@${HOSTNAME}"|grep -Eo "[0-9]{4}">~/.vnc/port.txt
# comment this out if you dont want a pop up telling you which port you’re using
zenity --info --text="Your VNC port is 'cat~/.vnc/port.txt'"
Step:4
chmod 755 /usr/local/bin/sharex11vnc
Step:5
Goto Applications -> Settings -> Sessions and Startup.
Step:6
Select “Application Autostart” and click on “Add” button.
In the Add application, Enter name (Whatever you want), description (can be left empty) and in Command, enter “x11vnc” (without quotes). Click on OK and check the “X11VNC” box and close it.