Cannot connect to x11vnc server before login

I have installed x11vnc on ubuntu 15.10. Based on:

Remmina cannot perform VNC remote desktop session before user logs in

I have created a new file: /etc/init/x11vnc.conf on MYSERVER containing:

start on login-session-start
x11vnc -display :0 -auth /var/run/lightdm/root/:0 -loop -forever -safer -shared -ultrafilexfer -bg -o /var/log/x11vnc.log -rfbauth /home/moore/.vnc/passwd -rfbport 5903 -http -users moore -nowireframe
end script

I have now rebooted MYSERVER and am trying to RDP to it from another ubuntu machine using Remmina:

enter image description here

But I just get:

enter image description here

I also tried following this guide:

same result.


As suggested below I have now tried to run:

x11vnc -display :0 -auth /var/run/lightdm/root/:0 -loop -forever -safer -shared -ultrafilexfer -bg -o /var/log/x11vnc.log -rfbauth /home/moore/.vnc/passwd -rfbport 5903 -http -users moore -nowireframe

from a terminal where I first SSH’ed to the server. It gave me this error:

...disabling -bg in -loop mode error opening logfile: /var/log/x11vnc.log open: Permission denied

But if I then do it as root from the same terminal it now works! But why does it not do that automatically when the machine is rebooted?

Notice when I did the small manual test above as root the file /var/log/x11vnc.log was created so it now exists with the following permissions:

-rw-r--r--  1 root              root     12640 Feb 19 00:26 x11vnc.log

But it still fails to start automatically on boot. It seems that whatever user is running the script on boot is NOT root.


The updated below answer solved the problem – that addresses the issue in Ubuntu 15.10.


There are only three things I can think of that might be preventing you from connecting:

  1. Do you have a firewall in place? Have you unblock access to port 5903? You can do that using UFW which is a GUI for your firewall in Ubuntu.
  2. Are you trying to access the server from outside your network? In that case you also have to forward the 5903 port on your router to access the VNC server (in addition to point 1). If you are getting this error when connecting from the same network, ignore this option but keep it in mind when connecting from outside the network.
  3. Last one, which is silly but I wanted to cover my bases. Are you trying to connect from the same computer? I don’t think x11vnc allows for loopback connections, so always try use a different computer when testing (or your phone).

I also use x11vnc server on my computer, but the difference is that only the localhost can access it. I also run an SSH server, that way I have a way more secure connection, and once a user ssh to your computer, they can connect to the VNC server as a localhost.

I hope this helps


After trableshooting, the problem is that Ubuntu 15.10 doesn’t have upstart so x11vnc will never run on boot.
Instead, you have to create a service and make it available at boot. Here’s what to do:

sudo nano /lib/systemd/system/x11vnc.service

Insert this into the file:


ExecStart=/usr/bin/x11vnc -display :0 -auth guess -loop -forever -safer -shared -ultrafilexfer -bg -o /var/log/x11vnc.log -rfbauth /home/moore/.vnc/passwd -rfbport 5903 -http -users moore -nowireframe
ExecStop=/usr/bin/killall x11vnc


Then you can start the service with:

sudo systemctl daemon-reload
sudo systemctl start x11vnc

And to make the service start on boot:

sudo systemctl enable x11vnc

This solution was previously posted by babelmonk here

Source : Link , Question Author : u123 , Answer Author : Community

Leave a Comment