Installing x11vnc

Reviews and other little ventures that don't quite fit into the other forums
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Installing x11vnc

Post by Daniel Wee »

Do not use tightvnc-server as those create virtual desktops rather than the actual one. For actual desktop, you will need an x11 compatible vnc.

https://tecadmin.net/setup-x11vnc-serve ... linuxmint/
https://askubuntu.com/questions/229989/ ... gin-screen

In this case, follow the instructions in the comments regarding setting up the service, rather than using /etc/init/x11vnc.conf

If the port is in use, you may run:-

lsof -i :5901

to see what is using port 5901

The program may suggest using the ncache option, but this is incompatible with several clients and produces long screens, so leave this out unless the client understands the caching.
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

The contents of the /etc/systemd/system/x11vnc.service is as follows:-
[Unit]
Description=x11vnc remote desktop server
Requires=display-manager.service
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -noxdamage -repeat -rfbauth /etc/init/x11vnc.pass -rfbport 5901 -shared -display :0
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
This assumes that you have successfully:-
1. installed x11vnc and net-tools
2. installed lightdm and switched to it from gdm3
3. installed the passwords for vnc
4. sudo systemctl enable x11vnc (so that this starts up at boot)
5. sudo systemctl start x11vnc
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

This presumes placing the password in the /etc/init/x11vnc.pass file with the command:-

sudo x11vnc -storepasswd xxxxxxx /etc/init/x11vnc.pass
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

This might help with potential solutions. We're having difficulty installing x11vnc on Ubuntu 18.04 with Wayland. The problem is that display :0 is not accessible it seems. This is especially so when launched in headless mode.

https://askubuntu.com/questions/767752/ ... less-16-04
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

This might help get display :0 on headless setups

https://fabianlee.org/2018/10/14/ubuntu ... ver-hosts/
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

Another thing to do is to use lightdm as the display-manager:-

sudo dpkg-reconfigure lightdm
sudo systemctl start lightdm

Then in the start up of x11vnc use:-

-auth /var/run/lightdm/root/:0

assuming that exists in the directory
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

Prior to anything working, you will need to ensure that:-

echo $DISPLAY

actually returns something like "localhost 0:0"

xhost

should also return something
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

In several cases, you may need to set up a dummy monitor with headless servers.

https://askubuntu.com/questions/453109/ ... plugged-in
https://askubuntu.com/questions/1066721 ... o-graphics
Daniel Wee
Site Admin
Posts: 2449
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: Installing x11vnc

Post by Daniel Wee »

This gives a working setup with lightdm:
https://www.crazy-logic.co.uk/projects/ ... en-sharing

This one is interesting in that it covers headless setups and also provides a gdm3 solution.
https://lxtreme.nl/blog/headless-x11/

Switching between lightdm and gdm3 can be done using:-

sudo dpkg-reconfigure gdm3
Post Reply