Ubuntu 18.04 LTS – Require username and password to log on

By default, an Ubuntu 18.04 LTS desktop workstation will list the existing users on the system on the login screen.

If you want to be prompted for both a username and a password each time you log in, follow the steps below.

#Update GNOME’s display manager configuration file

sudo vi /usr/share/gdm/greeter.dconf-defaults

Uncomment the following lines:

[org/gnome/login-screen]
disable-user-list=true

#Reconfigure gdm3

sudo dpkg-reconfigure gdm3

#In the settings window that appears, confirm gdm3 as the default dispay manager

#Reboot the system. You should now be prompted for a username each time you attempt to login