I'd like to access my "real" display remotely. Basically use my macbook to pilot what I see on the display of my local server. My goal is that the same image is duplicated: in the actual display of the linux box and via VNC on my macbook. I'm running Ubuntu 20.04 and it's November 2020.
As this dude says very poetically "I installed nomachine and it took the grand total of 2 minutes to setup and it works as I wanted".
The link also explains you must switch to lightdm. Fine.
if I try:
/usr/bin/x11vnc -display :0 -auth guess
I get:
22/11/2020 20:23:51 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 4745
22/11/2020 20:23:51 -auth guess: failed for display=':0'
if I try:
/usr/bin/x11vnc -display :0
I get:
22/11/2020 20:29:26 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 5167
Invalid MIT-MAGIC-COOKIE-1 key22/11/2020 20:29:26 XOpenDisplay(":0") failed.
22/11/2020 20:29:26 Trying again with XAUTHLOCALHOSTNAME=localhost ...
Invalid MIT-MAGIC-COOKIE-1 key
22/11/2020 20:29:26 ***************************************
22/11/2020 20:29:26 *** XOpenDisplay failed (:0)
*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.
if I try:
sudo /usr/bin/x11vnc -display :0
I get:
22/11/2020 20:30:22 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 5171
No protocol specified
22/11/2020 20:30:22 XOpenDisplay(":0") failed.
22/11/2020 20:30:22 Trying again with XAUTHLOCALHOSTNAME=localhost ...
No protocol specified
22/11/2020 20:30:22 ***************************************
22/11/2020 20:30:22 *** XOpenDisplay failed (:0)
*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.
Finally if I try:
sudo /usr/bin/x11vnc -display :0 -auth guess
I get:
22/11/2020 20:32:24 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 5188
xauth: file /root/.Xauthority does not exist
22/11/2020 20:32:24 -auth guess: using 'XAUTHORITY=/var/run/lightdm/root/:0' for disp=':0'
22/11/2020 20:32:24 Using X display :0
22/11/2020 20:32:24 rootwin: 0x583 reswin: 0x600001 dpy: 0xfd57d280
The VNC desktop is: NAS:0
PORT=5900
Which is great!
But now how can I make x11vnc run without sudo so that it can run automatically using systemd?
This is my current /etc/systemd/system/x11vnc.service
# Description: Custom Service Unit file
# File: /etc/systemd/system/x11vnc.service
[Unit]
Description="x11vnc"
Requires=display-manager.service
After=display-manager.service
[Service]
ExecStart=/usr/bin/x11vnc -loop -nopw -xkb -repeat -noxrecord -noxfixes -noxdamage -forever -rfbport 5900 -display :0 -auth guess
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
RestartSec=2
[Install]
WantedBy=multi-user.target
Two more interesting links on this topic: one with x11vnc and one with TigerVNC