x11vnc can not connect to X server of gdm greeter
OS: CentOS 8.3
GDM creates a X server for the greeter, and a different one each user that logs in. I am trying to run x11vnc to enable remote access to the machine, but x11vnc is rejected by the X server.
What is the way to run x11vnc such that it would connect to the 'greeter' display?
Additional details: the X server process is as follows:
~]# ps -ef | grep X
gdm 347880 347876 0 00:59 tty1 00:00:00 /usr/libexec/Xorg vt1 -displayfd 3 -auth /run/user/42/gdm/Xauthority -background none -noreset -keeptty -verbose 3
Trying to run x11vnc as follows:
x11vnc -rfbauth /etc/vncpasswd -auth /run/user/42/gdm/Xauthority -display :0
Result is:
X11 MIT Shared Memory Attach failed:
Is your DISPLAY=:0 on a remote machine?
Suggestion, use: x11vnc -display :0 ... for local display :0
caught X11 error:
03/05/2021 14:44:56 deleted 32 tile_row polling images.
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 130 (MIT-SHM)
Minor opcode of failed request: 1 (X_ShmAttach)
Serial number of failed request: 55
Current serial number in output stream: 89
Wayland is disabled:
~]# cat /etc/gdm/custom.conf
# GDM configuration storage
[daemon]
# Uncoment the line below to force the login screen to use Xorg
WaylandEnable=false
[security]
[xdmcp]
Enable=true
[chooser]
[debug]
# Uncomment the line below to turn on debugging
#Enable=true
Interestingly, with a slightly older installation, x11vnc connects successfully to the Xorg server and I'm able to connect to the machine with a vnc client.
I found that the (minor) version of Xorg is different. In the system in which x11vnc run succesfully:
~]# Xorg -version
X.Org X Server 1.20.6
X Protocol Version 11, Revision 0
Build Operating System: 4.19.34-300.el7.x86_64
Current Operating System: Linux centos01.dev.infinigon.local 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=(hd1,gpt2)/vmlinuz-4.18.0-193.28.1.el8_2.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet intel_idle.max_cstate=1
Build Date: 24 April 2020 02:49:29AM
Build ID: xorg-x11-server 1.20.6-3.el8
Current version of pixman: 0.38.4
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
And in the system in which x11vnc exits:
~]# Xorg -version
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
Build Operating System: 4.19.34-300.el7.x86_64
Current Operating System: Linux lab82dev 4.18.0-240.1.1.el8_3.x86_64 #1 SMP Thu Nov 19 17:20:08 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=(hd1,gpt2)/vmlinuz-4.18.0-240.1.1.el8_3.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet
Build Date: 24 August 2020 06:49:47PM
Build ID: xorg-x11-server 1.20.8-6.el8
Current version of pixman: 0.38.4
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Run x11vnc as gdm user:
sudo -u gdm x11vnc -rfbauth /etc/vncpasswd -auth /run/user/42/gdm/Xauthority -display :0