I'd like to set up VNC server on a Debian machine to run as a service so I can turn on a remote machine and access it without the need to be physically present.
One option is to set it up in the user-bus:
$ systemctl --user cat vnc.service # /home/stew/.config/systemd/user/vnc.service [Unit] Description=VNC Server After=default.target [Service] ExecStart=x11vnc -nevershared -forever -nopw [Install] WantedBy=default.target
This works, but still requires the me to physically sit at the terminal to log into
gdm3 to get
XAUTHORITY before I can do any remote work. If I
ssh in before logging in with
gdm3, the service fails. I work around this by using
Instead, I'd like to be able to use VNC without the need to log in as a specific user first (similar to RDP). I think the best way to do this is to use
-nopw to get to a
I tried to do that with:
$ systemctl cat vnc.service # /etc/systemd/system/vnc.service [Unit] Description=VNC Service (system-wide) After=graphical.target [Service] ExecStart=x11vnc -auth /run/user/116/gdm/Xauthority -display :0 -nopw [Install] WantedBy=graphical.target
I found the XAUTHORITY path with this command which revealed the path is owned by UID
116 (system user:
stew ~ $ ps wwwwaux | grep auth root 1033 0.1 0.5 189548 63596 tty1 Sl+ 14:32 0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/116/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -novtswitch -verbose 3
I also need to set
/etc/gdm3/daemon.conf because VNC doesn't seem to work with Wayland.
At first, this seems to work well. I get the
gdm login screen. But, when I try to log in as a user, the
auth gets transferred to another user and I am disconnected.
Is there a way to set up VNC so I can log in via gdm?