The Struggle with X11vnc Rebuilding Ubuntu Server

And then I got stuck again getting remote access to work. It’s funny out of all the great features, only the remote access is not the friendliest in Linux setup. There is no proper standard guide so far I could find on the internet for X11VNC. However, after a long spending trying out different guide that doesn’t work at all, I can now confirm only one guides actually tested working during my struggle.

Without doubt, this whole thing is funny and stupid. But as long the X11VNC able to work in startup on my headless server is all I need to access anytime. The first guide I follow is using the steps from Digital Drugs. I tested running the script below to confirm first before I proceed further.

start on login-session-start


/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -auth /var/run/lightdm/root/:0 -display :0 -passwd "MyPasswd" -forever -bg -o /var/log/x11vnc.log

end script

The TightVNC in my Window machine was successfully able to connect. Well, problem occurs. The password doesn’t recognize when I key in ‘MyPasswd”. So what went wrong? I have no idea to be honest. I went on looking on the previous guide by updating another code into the last script like below.

start on login-session-start


x11vnc -rfbauth -rfbport 5901 -auth /var/run/lightdm/root/:0 -display /etc/x11vnc.pass -forever -bg -o /var/log/x11vnc.log

end script

There are a lot changes and code remove in the script by following others. For example like the password column I replace with -passwd "MyPasswd" to sudo x11vnc -storepasswd /etc/x11vnc.pass in the script as recommended by many. Yet again, not working.

Frustrated as usual. I tried to remember to find my last bookmark and follow the steps of 'Setting up X11vnc' at Ubuntu Forum as shown below.

  1. Install x11vnc: sudo apt-get install x11vnc
  2. Set the password: vncpasswd ~/.vnc/passwd (vncpasswd is included with vnc-common, which is installed by default)
  3. Make it auto-start when the user logs in and show which port we're running on (useful if you run multiple vnc servers) the port will be put in ~/.vnc/port.txt: sudo gedit /usr/local/bin/sharex11vnc Paste in the following code:

x11vnc -nap -bg -many -rfbauth ~/.vnc/passwd -desktop "VNC ${USER}@${HOSTNAME}"|grep -Eo "[0-9]{4}">~/.vnc/port.txt

# comment out the following if you don't want a popup telling you which port you're using.
zenity --info --text="Your VNC port is `cat ~/.vnc/port.txt`"

  1. sudo chmod 755 /usr/local/bin/sharex11vnc

  2. System->Preferences->Sessions->Startup Programs then click Add and type in sharex11vnc

Add the code and restart, it finally works. This got me into thinking, are those scripts above are all wrong in the first place? But I can ensure that the first script that I tried does indeed work, just the password doesn't work even I change the password code. I'm not good in Linux, so it's hard to argue unless someone from the experts point out the problem.


Popular Posts