Configure vncserver on Ubuntu
Ubuntu version 12.04 through the latest tested (14.04) the default VNC Server only lets you connect remotely once the user has logged into Gnome or XFCE. This is not useful for a remote headless system. To configure the VNC Server to start with the system and listen before a user is logged in locally the vncserver must be configured to start with the system services. Obviously you need x11vnc installed before proceeding. Once installed...
First set a master password.
sudo x11vnc -storepasswd /etc/x11vnc.pass
Now an init script needs to be created so the vncserver starts at boot.
sudo vi /etc/init/x11vnc.conf
Creating an init script called xllvnc.conf in the /etc/init directory. Now add the following code to the script:
start on login-session-start script /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log end script
If you're using Ubuntu the xllvnc binary should be in the path /usr/bin/xllvnc. You can test to make sure it is installed and present in that path location by typing
file /usr/bin/xllvnc
When you reboot the system the VNC Server should be running. You can connect remotely prior to a local user starting a desktop session, or afterwards. You can start a desktop session remotely via vncviewer. It will be a shared session. You will see the same thing and will be controlling the same desktop that the local user is using. There is a way to have it create a separate session, however, that is not covered here.
REFERENCES AND SOURCES;