3

I'm trying to set up a VNC connection from my iMac to my (soon to be headless) Mac Mini running Ubuntu 16.10.

I'm using this tutorial: How to Setup X11VNC Server on Ubuntu & LinuxMint

Everything is perfect up through the section "Start X11VNC Server". I run the command from a terminal prompt, the server starts on the Ubuntu box, and I can instantly connect with my VNC client on the iMac (running Chicken).

So, looks good, next section is how to make it so the VNC server starts at boot and I assume that I don't need to be logged in to be able to connect.

I copied the code exactly as shown in the final section, with the one change of my user folder (/home/bryan/.vnc/passwd), saved and rebooted. Tried connecting and the client tells me Could not connect to server 192.168.1.2 port 5900 - The server refused the connection.

But then if I login on the Ubuntu box (currently have it connected up with a monitor, keyboard & mouse), and use the same command from before:

sudo x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/bryan/.vnc/passwd -rfbport 5900 -shared

The iMac can log me in perfectly, exactly the way I want it to.

Why doesn't it seem to load the server at startup, and how can I fix this?

Thanks for any replies!

4

The tutorial you referenced is outdated, it assumes you're on an older version of Ubuntu with Upstart as the init system (init systems control startup applications). Newer versions of Ubuntu use systemd as the init system.

You need to create a new file at /lib/systemd/system/x11vnc.service and put this inside the file:

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/bryan/.vnc/passwd -rfbport 5900 -shared

[Install]
WantedBy=multi-user.target

After you have created that file you need to enable and reload the service using systemctl by issuing these commands:

sudo systemctl enable x11vnc.service
sudo systemctl daemon-reload

I recommend restarting your system after running those commands.

Reference: http://c-nergy.be/blog/?p=8984

Note: to anyone else having the same issue and creating this file. Be sure to change the ExecStart line to point to your password, i.e. change /home/bryan/.vnc/passwd to /home/yourusername/.vnc/passwd

  • I'm still getting "connection refused" in 18.04 if I haven't logged in locally yet – endolith Dec 9 '18 at 23:00
  • Oh I don't even have x11vnc installed. This is not the native VNC server in Ubuntu; vino is. – endolith Dec 10 '18 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.