Question: How to disable the user list being shown when logging into a CentOS/RHEL 8 system?
There are 2 ways to disable the user list being shown on the login screen in CentOS/RHEL 8.
- Per user Settings
- Globally Settings for all users
Method 1 – Per User Setting
In this method, an individual user is removed from the user list which appears on the login screen. So if we disable the user “sandy”, it will not appear in the user list while other users will still be there on the list. If you want to disable all users to not appear in the user list, you will have to apply the same setting to an individual user. Instead, you can approach the global method of disabling the completed user list.
1. Modify the user profile settings file /var/lib/AccountsService/users/[username] and modify the line “SystemAccount=false” to “SystemAccount=true“. So if the username is john, you need to edit the profile settings file – /var/lib/AccountsService/users/john.
# vi /var/lib/AccountsService/users/john
id='centos'
version-id='8'
[User]
Icon=/home/john/.face
SystemAccount=false
2. Logout from the account and verify the login screen. The user “john” should not appear in the user list now.
Method 2 – Global Settings for all users
As we said earlier if you do not want any user list to appear at all on the login screen, follow the steps outlined below.
1. Create or modify the gdm keyfile /etc/dconf/db/local.d/00-login-screen and add the below lines to the keyfile.
# vi /etc/dconf/db/local.d/00-login-screen [org/gnome/login-screen] # Do not show the user list disable-user-list=true
2. After the file is modified, run “dconf update” as the root user to have it take effect. Also restart the gmd service if the changes are not reflecting.
# dconf update
# systemctl restart gdm
3. log out from the session and verify the login screen. It should now not show any user list on the login screen and instead ask for a username to be entered.