You are here

Get X11VNC working on bootup in Ubuntu

Submitted by Druss on Thu, 2019-11-21 00:03

Here are the steps I used to get X11VNC working on an Ubuntu (19.10) box. Hope this helps somebody else out there too.

  1. Install x11vnc using something like sudo apt install x11vnc
  2. Create a password to access X11VNC and store it in the /etc/ directory.
    sudo x11vnc -storepasswd /etc/x11vnc.pass
  3. Here's a tricky/dodgy bit from a security point of view. You will need to assign appropriate permissions to this x11vnc.pass file. For my local needs I just set it to readable by all using sudo chmod a+r /etc/x11vnc.pass . You might want to tweak this according to your needs.
  4. Create a service that will run on bootup:
    • sudo vi /etc/systemd/system/x11vnc.service
    • Add the following to the file:
      [Unit]
      Description=x11vnc remote desktop server
      After=multi-user.target

      [Service]
      Type=simple
      ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

      Restart=on-failure

      [Install]
      WantedBy=multi-user.target
  5. Now enable and start the new service using the following commands:
  6. sudo systemctl enable x11vnc.service
  7. sudo systemctl daemon-reload
  8. sudo systemctl start x11vnc

Check to see if it works and restart your box to double check. I was able to VNC in even when my Xubuntu box was at the login screen. Good luck!