Want to prevent all users from listing in login screen, then type your username and password to login? Here’s how to do it in Ubuntu 20.04, Ubuntu 22.04 & Ubuntu 23.04 (updated) with the default Gnome Desktop.
There are 3 ways to do this job: create a configuration file and write rules to disable user list, run
gsettings command in terminal, or use a graphical configuration tool.
Option 1: Create configuration file to disable user list
terminalby pressing Ctrl+Alt+T on keyboard. When it opens, run command:
sudo gedit /etc/dconf/profile/gdm
For Ubuntu 22.10+ replace
The command will create a profile and open it via Gedit text editor. When the file opens, paste following lines and save it.
user-db:user system-db:gdm file-db:/usr/share/gdm/greeter-dconf-defaults
- Run command to create
/etc/dconf/db/gdm.ddirectory if it does not exist.
sudo mkdir /etc/dconf/db/gdm.d
- Create and edit the key file under this directory:
sudo gedit /etc/dconf/db/gdm.d/00-login-screen
When the file opens, paste following lines and save it.
[org/gnome/login-screen] # Disable user list from login screen disable-user-list=true
- Finally update database to apply changes by running command:
sudo dconf update
Option 2: Disable user list via gsettings command.
The gsettings configuration tool can do the job. However, you need to get
gdm user privilege before running the command.
NOTE: this method may not work on Ubuntu running as guest in Virtualbox.
Get gdm user privilege in terminal:
First open terminal by pressing Ctrl+Alt+T on keyboard, and run following commands one by one.
- Run command to get root permission:
- Add local user gdm to access control list:
- Get the gdm permission in this terminal window:
su gdm -s /bin/bash
Run gsettings command:
In this command window, run command:
gsettings set org.gnome.login-screen disable-user-list true
Though the command outputs a flatpak permission denied warning, it works in my case after restart.
Option 3: Use “Login Manager Settings” (Graphical)
For Ubuntu 22.04 and higher, there’s now a new graphical configuration tool that can do the job. Not only for hiding user list, but also changing login screen background, text font, color scheme, etc.
1. First, press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, run command to enable Flatpak support.
sudo apt install flatpak
2. Next, run command to install the application as Flatpak:
flatpak install https://dl.flathub.org/repo/appstream/io.github.realmazharhussain.GdmSettings.flatpakref
3. Once installed, press Super (Windows logo) key on keyboard to open overview. Then search for and launch ‘Login Manager’ settings tool.
4. The tool has many useful configuration options. In this case, go to ‘Login Screen’ tab from left pane, then turn on the toggle switch for “Disable User List”.
Finally, click on ‘Apply’ button and type user password to confirm and done!