Ubuntu 15.04 – Configure your system to have x11vnc running at startup

Hello World,

If you are following us, you probably remember that we wrote already a post about this topic (see Ubuntu 14.10 – Configure your sytem to have x11vnc running at startup).  Since Ubuntu 15.04 is using systemd, the instructions found in the previous post are not applicable anymore.  Some of our readers had issues after upgrading to Ubuntu 15.04.  The x11VNC is not running at startup anymore.

This post will provide the necessary information to have x11vnc running at startup on ubuntu 15.04 when systemd is used.


Our Goal !

At the end of this post, you should be able to connect via vnc to your Ubuntu machine even if there is a reboot and even if no user are logged into the machine.  This configuration should display the login screen via vnc viewer client you are using.

We didn’t invent anything here.  All the information provided here are based on the information made available at this location :  https://help.ubuntu.com/community/VNC/Servers#Have_x11vnc_start_automatically_via_systemd_in_any_environment_.28Vivid.2B-.29

Installing x11vnc server

In this post, we have decided to use the x11vnc server package to provide vnc capabilities.  The installation process is quite straight forward.  Log into your ubuntu 15.04 machine, open the terminal console and issue the following command :

sudo apt-get install x11vnc

Click on Picture for Better Resolution

To have a minimum of security, we will protect the vnc connection via a password.  The password will be stored in a file.  To create this file, you will need to issue the following command

sudo x11vnc storepasswd /etc/x11vnc.pass

You will be asked to enter a password. Enter the password and confirm your choice and you should be good to go

Click on Picture for Better Resolution

Create the Service Unit file

So far, we have just issued standard command related to the x11vnc package.  We need to create the service unit file for our x11vnc service.  To do this, we will issue the following command :

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

This file should content the following lines

Description=Start x11vnc at startup.
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

Save the file

Configure Systemd

It’s time to issue the command to have systemd aware of the change and make the service running at startup.  In a command prompt, you will issue the following command :

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service


Restart the system and do not login.  We will check if this is working…..

Testing the solution !

To check that you can indeed perform a vnc connection to your Ubuntu Machine, you will try to connect to it using your favourite vncviewer (we are using TigerVnc) while nobody is connected and just after a reboot of the machine.

In the vncviewer, you will provide the ip address or hostname of the machine to connect and the port to be used.  In our example, he port used is 5900.  If you have set a password to protect your vnc connection, you will be prompted for a password as well.

Click on Picture for Better Resolution

If everything is ok, you should see the Ubutun login page displayed inside your vncviewer

Click on Picture for Better Resolution


Final Notes

And voila !  We have sucessfully updated the instructions on how to have x11vnc run at startup.  As you can see, since Ubuntu 15.04 is using the Systemd solution, we need to create our service unit files (x11vnc.service) and register them with systemctl and we are done.

Pff… the last days I have updated some of the most popular posts about xrdp, x11vnc and ubuntu 15.04… It’s time for me to take a break…

Till next time

See ya



81 thoughts on “Ubuntu 15.04 – Configure your system to have x11vnc running at startup

  1. Hello Tony,

    There is no need to use the rbfauth when creating the password file. We didn’t and the file has been created accordingly.
    The rfbauth option should be used when you perform your connection and you need to pass the password

    thank you for the feedback
    Till next time

    See ya

  2. FYI. Could not create the password file, would error out everytime, and after many attempts stumbled on the rbfauth option and that is the only way the password file could be created. This was on a clean install of Ubuntu 15.04. Hope that is of any help.

  3. Hello Tony,

    Thank you for sharing the info and providing such information…

    but we are just surprised that you had to use the rfbauth switch (as we didn’t and we perform the operation on a clean ubuntu 15.04 as well)

    Can you provide the error message you are getting so if people have indeed issues creating the password file, they could easily retrieve these comments and try the rfbauth option

    Thank for the visit and comments
    Till next time
    See ya

  4. Unfortunately I never got to capture an error of sorts other than being prompted that the command line usage was not valid or missing something along with a list of options. In my situation I would not be prompted to create a password until the usage of the rfbauth option in the command string.


  5. Doesn’t work on my 15.04.
    Had X11 installed before update.
    I’ve been looking for days and numerous sites to figure out why.
    How can I remove X11 completely with no leftover files to try your tutorial over again?
    It’s driving me nuts now

  6. Hello Pascal,

    Have you tried the standard way to remove software… sudo apt-get remove x11vnc…..
    Maybe you can fix your issue ? Can you see what’s the error ? Can you manually start your x11vnc service or does it returns an error ?
    can you run the systemctl command and check what’s the output ….?

    Hope that this can help
    Till next time
    See ya

  7. I was able to create a VNC connection with your tutorial, however, every time I try to connect into the rebooted Ubuntu (not logged in) with TightVNC from my windows 7 laptop, it handshakes with host, I enter the password I set up, and it says “password check failed”. Any suggestions?

    When I use terminal commands once logged in I can get it to connect and authenticate just fine. For some reason it also changes my ports (from 5900 to 5902). Any help would be a great help!

  8. I have a laptop that I’m setting up to run the x11vnc system but I’m having an issue getting it to auto start on my laptop i have followed the instructions here but it will not start. My laptop is set so that it will auto login to my account since it is the only account on the system the laptop is running Xubuntu 15.04 and i can run x11vnc just fine even though i have to manually start it each time the laptop is started. any help would be greatly welcomed.

  9. Hello There,
    Sorry for the delay in the answer but I was abroad for some time
    If you have followed exactly the process described in the post, you should have your x11vnc service starting at boot time. Are you sure you have executed the following commands

    sudo systemctl daemon-reload
    sudo systemctl enable x11vnc.service

    please review your logs on the system and see what could be the issue

    Hope this help
    Till next time
    See ya

  10. Hello There,

    I would check that the /etc/x11vnc.pass file has been created accordingly on your system. I usually see this kind of error when the pass file is missing (or empty) or because there is a typo in the service file when specifying the pass file as well

    A good test to validate your installation would be to remove the password file from the X11Vnc and see if you can connect….

    The other thing strange is that you should always connect to port 5900 -> if you connect to multiple ports, that means that you have different session running on your system.

    Hope this help
    Till next time

    See ya

  11. yes the pass file has been created and every thing is fine as far as I can tell btw I’m running Xubuntu 15.04 and my laptop is set to auto log in.

    On my laptop Ido not see a log in screen at all.

    Now if there is a log some where that will let me know if it is failing because of an error that might be helpful in fixing the issue.

  12. Hello there,

    To quickly see what’s the problem, you could try to execute the command in the Terminal session
    Run from Terminal
    x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

    and see what’s the error is thrown at you


    To generate log files, you would need to modify your X11Vnc Service unit file. You would need to add in the following command
    ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

    this parameter -o /var/log/x11vnc.log

    This will generate the log file under the /var/log/ directory…

    Another idea/hint might be permission issues. I came accross in situation where the x11VNC.pass file was readable only by root. Maybe the x11vnc.pass file is not readable by the system…

    Hope this help
    Till next time

  13. Every thing is fine as far as the cmd line is concerned.

    Although i did have to use sudo chmod 755 on the pass file so that a non sudo cmd line would be able to read the file.

    Now I did add the logging option and rebooted my Xubuntu laptop then checked in /var/log for the log file, but there was no log file present which means the service is not starting at all.

  14. OK,

    Can you try to see what’s happening….. when your machine is starting….

    Can you type one of the following command

    sudo systemctl status x11vnc (-> what’s the output…is service running or failed)

    if you type
    sudo service X11vnc restart

    does the service start or do you have an error thrown at you ? If you have an error, you can then use the following command line to see what’s might be the problem

    journalctl -xe (anything in red is not good)

    You have to provide us some debugging information to see what might not be working as expected….
    Give it a try to see why the service is not starting ….

    Hope this help
    Till next time
    See ya

  15. well here is some information i hope it helps.

    wolfpup@Presario-CQ70:~$ sudo systemctl status x11vnc
    [sudo] password for wolfpup:
    \u25cf x11vnc.service – Start x11vnc at startup.
    Loaded: loaded (/lib/systemd/system/x11vnc.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2015-07-28 08:05:26 EDT; 3min 48s ago
    Process: 1740 ExecStart=/usr/bin/x11vnc -auth guess -xkb -noxrecord -noxdamage -repeat -cursor_drag -cursor most -gui tray -forever -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared -o /var/log/x11vnc.log (code=exited, status=1/FAILURE)
    Main PID: 1740 (code=exited, status=1/FAILURE)

    Jul 28 08:05:26 Presario-CQ70 systemd[1]: Started Start x11vnc at startup..
    Jul 28 08:05:26 Presario-CQ70 systemd[1]: Starting Start x11vnc at startup….
    Jul 28 08:05:26 Presario-CQ70 x11vnc[1740]: error: cannot determine X DISPLAY for gui to display on.
    Jul 28 08:05:26 Presario-CQ70 systemd[1]: x11vnc.service: main process exited, code=exited, status=1/FAILURE
    Jul 28 08:05:26 Presario-CQ70 systemd[1]: Unit x11vnc.service entered failed state.
    Jul 28 08:05:26 Presario-CQ70 systemd[1]: x11vnc.service failed.

    my laptop is an old Compaq Presario CQ70-120US running Xubuntu 15.04

    if there is more information you need please let me know along with instruction on how to get it for you.

  16. Hello Wolfpup,

    Sorry for the delay in the answer…So I just tried the procedure described in the post on Xubuntu with autologin enabled and it works…. I just followed the step by step procedure and it simply works….

    Now looking at the output you have provided me, it seems that you have passed multiple additional parameters to x11vnc (in the service unit file)
    So my guess is that you are using an invalid switch….. So, to have it working; Please follow the procedure described in the post provided to you first…. (including the service unit file). If after you want to make changes; make them one by one….and validate your changes….

    Till next time
    See ya

  17. Thanks for providing this information! I was able to get it to work.
    The only glitch I had was the command:
    sudo x11vnc –storepasswd /etc/x11vnc.pass
    The ‘dash’ preceding the storepasswd command is not seen as a dash, but as something else.


  18. Hello Raoul,

    Yes, we are aware that our blog theme might impact the formatting during/copy paste operations.. we are working on that as we will soon switch to a new look n feel/Design for the blog part

    Thank for the positive feedback and the visit
    Till next time
    See ya

  19. Hi there, I’ve followed quite a few of your guides. Mainly the one to get xRDP running and it works great, but wanted to access my unity desktop rather than gnome, so follwed this x11vnc guide.

    Everything works great. The service starts on boot. I can log into the unity desktop, but with in a second it logs me out back to a log in screen, and I get stuck in this same process

    The username for my account on the Ubuntu box is homeserver, not Chris

    I have made a little screen recording to show what it is I’m experiencing. Hopefully you’be able to shed some light on this for me.


  20. I should have added that when the server is rebooted I can log in fine, however after the logging off, and then attempting to log back in that’s when I get this log in loop issue.

    Until I reboot when it works fine again.

  21. Hello Chris;

    We just tested the procedure again…we have locked our ubuntu machine and logged again with no issues.
    Can you confirm that this behavior only happens on remote connection or do you have the same issue on the physical ubuntu machine
    If you have the same behavior on the physical machine; your system might be “broken”. were you doing updates and shutdown the machine in the middle of the update process ?

    We also notice in your video that when you lock your system you have the MATE-Desktop login displayed. In a pure unity desktop environment, when you lock your worksation, you should see the standard login page (unity greeter)

    So, at this point, I would really first check what’s happening on the physical machine. If you have the same behavior as you have when remoting to the computer; the ubuntu system has a issue not the remoting process. If issue on the physical machine, try to repair your system or try to update to ubuntu 15.10 (out in about 1 month)

    Hope this help
    Till next time

  22. Hi thanks for getting back to me.

    The mate desktop is part of an xrdp set up that I followed of yours.

    Logging into the physical machine works fine. I don’t get any issues at all with this logging out thing, and it only happens after the the first vnc session after a reboot. It’s very strange.

    How would I remove the mate environment and get it back to pure unity to run with vnc?

  23. Appear to have resolved this now.

    I removed the mate desktop environment, and made sure that I had the standard unity login screen. This now stays logged in

    So the issue was that the mate environment from my xRDP setup was causing issues.

    The one other thing I wanted to ask was about the screen lag now when using VNC via the WAN. Can this be improved on somehow?

    It’s really quite a noticeable lag

  24. Hello Chris,

    good to hear that you have fixed your issue…. our intuition was correct about the mate-desktop…normally, the xrdp procedure or script we described are working and make the mate-desktop functional. Some time it can happen that package does not install correctly.

    your quetion about the lag issue, try to tweak your mstsc client settings, try to use one of the latest version (no background,experience, quality color depth….)

    hope this help
    Till next time

    See ya

  25. Well I’ve played around with everything I can think of and still the performance of VNC over WAN is terrible.

    The screen lag is unworkable. I may end up going back to xRDP, but I was hoping VNC was going to work to allow me to use the real desktop, rather than virtual desktops like xRDP does.

    I”m a little frustrated, but glad I tried and learnt some valuable things from the post.

  26. Hello Chris,

    what about novnc (web brower – vnc), could this improve the performance over the WAN….
    Now, we understand that you are using vnc client on windows. You have to check if the mirror drivers (used to improve performance) can help you in your situation

    Thank for all the useful feedback provided so far
    Till next time
    see ya

  27. I’m only using Windows as the VNC viewer. Would this still need the mirror drivers?

    My understanding was this was only server on the server side

    I’ll have a look into novnc as an alternative. Thanks

  28. Hello Chris,

    X11VNC is a great vnc server but X11vnc can be chatty. You have other options to try to improve performance if you want to use x11vnc (using options like ncache 10
    ncache_cr) could improve your performance a little bit

    from x11vnc website :

    Note: A quick way to get a 2X speedup of this for x11vnc is to switch your X server from depth 24 (32bpp) to depth 16 (16bpp.) You get a 4X speedup going to 8bpp, but the lack of color cells is usually unacceptable.

    You might wanna try a different vnc server to see if you can improve performance using the mirror drivers ( Yes, the mirror drivers is on the server side). This is why I mentioned the mirror drivers. I usually use x11vnc over the LAN and not on WAN. So by using a different more popular vnc server/viewer might improve the performance (but this is just a guess)

    Till next time
    See ya

  29. Hi, I followed guide and all works fine. But after login in tightvnc im getting a blank black screen. I use Gnome desktop and not unity. Anything i need to change ?

  30. hello there,

    I have no clue about this issue…i would need to tst it first and come back to you later on…
    If you use the unity is it working then ?

    till next time
    see ya

  31. hi – thanks, great tutorial and working for me on ubuntu 15.04. couple questions:

    1) on an older installation I was using /etc/init to start up x11vnc and using the -bg option. With your tutorial using systemd this won’t work for some reason – and I am instead using -loop as suggested. however, this appears to spawn 2 identical processes. Is that normal? And does this consume twice as much resources or is one just a dummy process to assist in the restart?

    2) i use two x11vnc instances so i can have one as a black screen (-nofb) which is great for controlling a projected image since it allows me to use keyboard and trackpad without the bandwidth of sending back data to the client. for this i created a second service.. is there a way to start both instances in one service? I tried adding a second `ExecStart` line but does not seem to work. i suppose i could write a bash script but just new and learning about systemd.

    and finally something to note, again for use with a projector, I had to run the following the get the mouse pointer to show up without a mouse connected:

    gsettings set org.gnome.settings-daemon.plugins.cursor active false


  32. Hello Billy,

    sorry for the late reaction…I’m quite busy with my work…..

    Question 1 – X11vnc might create zombies processes. This is maybe why you see some additional processes… Try to kill one of the process and see if you are not disconnected and fix your issue, you might then try to clear all the hung session using command line options like clear-all (or clear_all) -> to be checked….

    Question 2 – I have no idea if this can be done.. we will need to check for that….

    Hope this help
    Till next time
    See ya

  33. Hello, thanks for this guide.

    I have an issue which brought me here. x11vnc works perfectly EXCEPT it never asks me for a password, it just lets clients connect with no password.
    I purged x11vnc from my laptop (sudo apt-get purge x11vnc), rebooted and then followed your guide to the letter, but x11vnc still does not ask for password when clients log in. ???
    Its actually running Lubuntu 15.04 (light version of ubuntu) but i assume the commands should be the same as Ubuntu (I’m new to linux)

    I have it set to automatically log me in to lubuntu when it starts, maybe thats causing an issue?

    Do you have any idea’s? -Cheers!

  34. Hello Norm,

    I’m currently travelling for work and currently no time to check at your issue
    If you can wait a week or two, I should then be able to have a look

    Till next time
    See ya

  35. Hello Griffon,

    Just wanted to thank you for such a useful post. I followed these steps on a Raspberry Pi running Ubuntu Mate and it worked without issues.

    I was already using x11vnc but I had to start it from a separate SSH session every time it rebooted or when I closed the VNC session, now it runs at startup.

    P.S. The “sudo apt-get install x11vncserver” command as shown in the screen capture did not work because it doesn’t exist for the Raspberry Pi distribution probably. Removing the “server” part worked.

    Best Regards,
    – Juan Carlos Espinoza

  36. Hello there,

    Thank you very much for the feedback and information about how to make it works under a Raspberry pi

    Till next time
    See ya

  37. Finally a post that works, thanks so much! I can verify that this works with Ubuntu 15.10 and Mac OSX 10.11.3’s native “Screen Share” VNC viewer client. During install, which was through an SSH CLI, I also had to use “sudo x11vnc rfbauth -storepasswd /etc/x11vnc.pass” like Tony. If I didn’t rfbauth, it would start x11.

    I’m using this for fun at home, but am still security paranoid. Prior to using my VNC viewer, I SSH to the box and tunnel port 5900 to encrypt. Here’s an example:

    ssh user@ -L 5900:localhost:5900

    Then connect to this address via OS X Screen Share: vnc://localhost

    Thanks again, now onto working on enabling Wake-On-Lan 🙂

  38. Hello Eddard,

    Thank you for the feedback and the useful information you are providing here..
    We will have a look into these topics in a near future and we will probably posts some updates about that

    Till next time
    See ya

  39. I’m using ubuntu mate 15.10 and this goes tits up from here.

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

    I get a “sudo: nano: command not found” error ?

    This worked great on Ubuntu mate 15.05

    I also had to use “sudo x11vnc rfbauth -storepasswd /etc/x11vnc.pass” for the password.

    So what’s changed ?

  40. Hell Mark,
    nano should be a default command in ubuntu 15.04 and 15.10…maybe a typo on your side…If nano command does not work, try sudo gedit /lib/systemd/system/x11vnc.service

    As I’m just back from heavy project abroad, I will try to update this post for ubuntu 16.04 (still beta) and see if there are some changes or not

    Till next time
    See ya

  41. Hi Griffon,
    Thanks for the reply. I was trying this on Ubuntu 15.10 for My Odroid Xu3 Lite but this image is a bit unstable so I think I will go back to 15.04 for now which you guide worked for perfectly before.

    Thanks again.

  42. Hello
    I’m using Kubuntu 15.10 and tried the solution. The service is running but i get an xauth: unable to generate au authority file name

    The x11vnc commad works when i put sudo in front of it so i suspect it has something to do with root permissions.

    I made the pass file world readable. I tried putting the path to the .Xauthority file and make it readable too but it doesn’t work.

    How can i do to have the service launch as root in the service file?

  43. I made the service launch and work. However i have a problem, it doesn’t launch at the login screen but once i have logged in.

    I’m not the one who installed the computer as i’m in a university network. I think there’s a custom login screen manager.

    can it be the reason?

  44. Hello There,

    I don’t think that the login manager is the problem… So to summarize, you have installed x11vnc, you have created the x11vnc password ,you have created the x11vnc script and you have reloaded the daemon, right ?

    If you have performed the described steps in the post, everything should be working. If there is an issue, we should check that the service is effectively running (systemctl status x11vnc) and we might want to use the x11vnc command line to generate some logs and see what might be the issue

    Hope this help
    Till next time
    See ya

  45. Hello griffon,

    I did those steps. So here it is:
    When i’m logged in (so plasma session in on). If i do x11vnc -auth guess … it doesn’t work. However if i do x11vnc -findauth and paste the search result in the x11vnc.service it works.

    Now, if i reboot and come to the login screen, it doesn’t work. If i do alt+ctrl+F1 do open a terminal and do systemctl status x11vnc.service, the service is running but it tells me that the auth file can only be read with root access. When i do x11vnc -findauth it doesn’t find any auth file compared to when i have started a session.

    So it seems the problem is that since no plasma session is started, there’s no auth file available or it can’t find it, thus the service in active but the command execution fails.

  46. Hello There,

    Just a guess (or idea)
    I’m not a specialist of systemd but I think, you can configure the service file to include user information
    In your x11vnc.service file in the [Service] section, add a line similar to this

    Save it and give it a try

    Hope this help
    Till next time
    See ya

  47. Hi,

    Tried that, but then i got a 217/USER error which seems to indicate the systemd unit file could not be run as me which seems legit since i didn’t give any root password.
    Do you know to make a systemd run as root?

  48. Hi there,

    Found the solution, i’m using sddm as login manager and the auth file couldn’t be found either by -auth guess or -findauth option.

    the xauth file was into var/run/sddm/

    Thanks !

Leave a Reply