User Tools

Site Tools


configuring_the_right_vnc_setup

Configuring Remote VNC on Ubuntu


Ubuntu 18.04 (and possibly later versions) switched from LightDM to GDM3. Connecting to the login screen with VNC while using GDM3 is currently not possible. The easiest way to get this VNC functionality back is to simply switch back from GDM3 to LightDM (which is still being activity developed and used by many Linux distros).

Install LightDM

apt install lightdm

Should you for some reason come to regret switching to LightDM you can revert back to GDM3:

dpkg-reconfigure gdm3

Install x11vnc from packages

apt install x11vnc

Create the file /lib/systemd/system/x11vnc.service with the following contents:

# Description: Custom Service Unit file
# File: /lib/systemd/system/x11vnc.service
[Unit]
Description="x11vnc"
Requires=display-manager.service
After=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -loop -nopw -shared -xkb -repeat -noxrecord -noxfixes -noxdamage -forever -rfbport 5900 -display :0 -auth guess
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
Restart-sec=2

[Install]
WantedBy=multi-user.target

Set the x11vnc service to automatically start at boot

systemctl enable x11vnc.service

Start the x11vnc service

This assumes screen :0 represents your monitor and binds x11vnc to that monitor instead of a session. If you do not have a monitor (headless) it is possible to install a fake monitor driver and bind x11vnc to that.

systemctl start x11vnc.service

Side Notes

  1. In case you are using virt-manager (which also enables VNC on 127.0.0.1:5900), you may want to bind x11vnc to your LAN IP (-listen 10.0.0.1)
  2. The parameters used to start x11vnc tell it not to ask for an additional password (-nopw)

Require username at GUI login (hiding list of valid users)

The user list shown at login can be disabled by setting the org.gnome.login-screen.disable-user-list GSettings key.

When the user list is disabled, users need to type their user name and password at the prompt to log in.

Create the gdm profile (/etc/dconf/profile/gdm) which contains the following lines:

user-db:user
system-db:gdm
file-db:/usr/share/gdm/greeter-dconf-defaults

Create a gdm keyfile for machine-wide settings in /etc/dconf/db/gdm.d/00-login-screen:

[org/gnome/login-screen]
# Do not show the user list
disable-user-list=true

Update the system databases:

dconf update
configuring_the_right_vnc_setup.txt · Last modified: 2024/12/27 20:48 by mike

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki