Ubuntu 20.04LTS with GDM3: Disable User List at the Login Screen 4
Having a list of all users on the login screen might not be an excellent idea for shared computers. The Gnome Display Manager (GDM) is the graphical login system used by Ubuntu 20.04LTS and it offers an option to hide the user list and type in both the username and the password.
To disable the user list execute the following:
# Type the following to get the value of the DISPLAY variable, we will need in in a couple of steps.
echo $DISPLAY;
# It will print out :0 or :1 or similar
# Give temporary access to user gdm to access control list and to applications that need a monitor:
sudo xhost +SI:localuser:gdm;
# Output will be something like the following:
# localuser:gdm being added to access control list
# Switch to the user (su) gdm using bash shell
su gdm -l -s /bin/bash;
# Set the DISPLAY variable to the value you got before (could be :0 or :1 or similar):
export DISPLAY=:0;
# Disable the user list by setting the disable-user-list flag to true:
gsettings set org.gnome.login-screen disable-user-list true;
Next time you restart, you will not get a user list but a text input to fill in the username.
To restore/enable the user list:
# Type the following to get the value of the DISPLAY variable, we will need in in a couple of steps.
echo $DISPLAY;
# It will print out :0 or :1 or similar
# Give temporary access to user gdm to access control list and to applications that need a monitor:
sudo xhost +SI:localuser:gdm;
# Output will be something like the following:
# localuser:gdm being added to access control list
# Switch to the user (su) gdm using bash shell
su gdm -l -s /bin/bash;
# Set the DISPLAY variable to the value you got before (could be :0 or :1 or similar):
export DISPLAY=:0;
# Enable to the user list by resetting it to its default value:
gsettings reset org.gnome.login-screen disable-user-list;