I like my VNC server to run only when I have actively started using my desktop. I often get lazy and wish to continue work from my bedside laptop.
If you would like to run x11vnc as a daemon use the alternate steps below
Running vnc server after logon:
Step 1> Setup a VNC Password File
$>x11vnc -storepasswd
After entering your password twice, the .vnc/passwd file will be created
Step 2> Setup x11vnc to run when you open up a terminal
open up your bashrc ($>nano ~/.bashrc) and add the following line
x11vnc -forever -bg -display :0 -rfbauth .vnc/passwd
Step 3> Download TightVNC viewer for windows and connect!
Running vnc server as a daemon
Step1: Run the following commands
$>sudo cp /etc/init.d/skeleton /etc/init.d/x11vncserver
$>sudo chmod 775 /etc/init.d/x11vncserver
$>sudo nano /etc/init.d/x11vncserver
Step2: Replace the corresponding lines in the file by this
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=”X11 VNC Server Service”
NAME=x11vnc
DAEMON=/usr/bin/x11vnc
DAEMON_ARGS=”-bg -forever -display :0 -rfbauth /home/pr0t0s/.vnc/passwd”
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
Step3: Install x11vncserver as a daemon
update-rc.d x11vncserver defaults 97 03
Step4: start the service!
sudo service x11vncserver start
Step5: Download TightVNC viewer for windows and connect!