HOWTO: Setup VNC Server (x11vnc) on Linux Mint 18

n838901
  7 years ago
  6

This tutorial was adapted from here.

1. Remove the default Vino server:

sudo apt-get -y remove vino

2. Install x11vnc:

sudo apt-get -y install x11vnc

3. Create the directory for the password file:

sudo mkdir /etc/x11vnc

4. Create the encrypted password file:

sudo x11vnc --storepasswd /etc/x11vnc/vncpwd

You will be asked to enter and verify the password.  Then press Y to save the password file.

5. Create the systemd service file for the x11vnc service:

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

Copy/Paste this code into the empty file:

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

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

[Install]
WantedBy=multi-user.target

6: Reload the services:

sudo systemctl daemon-reload

7. Enable the x11vnc service at boot time:

sudo systemctl enable x11vnc.service

8. Start the service:

Either reboot or

sudo systemctl start x11vnc.service

Comments
Ovalwingnut 2 years ago

"I was blind but now I can see". My friend, you have snatched the pebble from my hand... You "are" the VNC Whisperer.. YOU ROCK! Cheers from So.CA,USA, 3rd House on the Left.


celantunes 3 years ago

Muito obrigado por compartilhar este conhecimento.


myself42 4 years ago

Work like a charm on Linux Mint 20 MATE (& Jrwilmoth040707's addon works too).
Thanks!


technotricks 4 years ago

Perfect for a Linux freshman like me! worked a treat thank you!


jrwilmoth040707 5 years ago

I had to add a bit more to the one you developed to prevent the service from dying upon remote log off.

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

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -noxdamage -repeat -rfbauth /etc/x11vnc/vncpwd -rfbport 5900 -shared
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target


kx3210 6 years ago

Hi - sorry ignore the last post - must learn to check my spelling - working thanks


kx3210 6 years ago

Hi - just tried this on lmde 3 and I get the following when I try to enable at startup
sudo systemctl enable x11vnc.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.



rafaldrive 6 years ago

Works great, thank you!


Hacklet 6 years ago

Thanks for that excellent little guide. It's the most simple and concise one I have found anywhere!


desecheo 6 years ago

Worked well, many thanks!


MikeLieberman 7 years ago

I have found that on ALL the four computers on which I installed this, the service does not start at boot and I have to SSH in and give the "systemctl start x11vnc.service" command to regain VNC access.


MikeLieberman 7 years ago

OK for some reason on the second Mint 18.1 I have installed it on, there is a small problem. I can access the remote once.

The next time I try, even if all I did was log off and not issue a restart, the remote unit actively refuses my request.

However if via SSH access to the remote unit, I issue the:
systemctl start x11vnc.service
I can log in again via TightVNC.

This is happening on only one of the three units I have installed this on tonight.


MikeLieberman 7 years ago

For what it is worth, I just now used this also on a Debian 9 install and it worked fine on that too.


MikeLieberman 7 years ago

WORKS!

Using Mint 18.1.

Perfect. Thank you so very much.


DovaMerith 7 years ago

How do i get it so i can connect to my PC