The Auto-Login Security Risk
During the initial installation of Ubuntu Desktop, the setup wizard asks if you want the system to “Log in automatically.” If you select this option, Ubuntu configures its display manager (GDM3 – GNOME Display Manager) to bypass the login screen entirely. When you press the power button, the computer boots straight to your desktop without ever asking for a password.
While this is convenient for a family PC sitting in a secure living room, it is an unacceptable security risk for a laptop that leaves the house, or a desktop in a shared office environment. Anyone who turns on your machine instantly has full access to your web browser, saved passwords, and private files. You must disable this feature to enforce password authentication at boot.
How to Disable GDM3 Auto-Login
You can turn off auto-login via the graphical Settings menu or the terminal configuration file.
Method 1: Using the GUI
- Click the system menu in the top right corner of the screen and select Settings.
- In the left-hand sidebar, scroll down and click on Users.
- Click the Unlock button at the top right and enter your password.
- Find the toggle switch labelled Automatic Login.
- Toggle the switch to the Off position.
Method 2: Using the Terminal (For Server/Headless Setups)
- Open your Terminal (
Ctrl + Alt + T). - Open the GDM3 custom configuration file:
sudo nano /etc/gdm3/custom.conf
- Look for the
[daemon]section. You will likely see two lines under it:
AutomaticLoginEnable=True
AutomaticLogin=yourusername
- Comment out both lines by placing a hashtag (
#) at the beginning of them, or changeTruetoFalse. - Save the file (
Ctrl + O,Enter) and exit nano (Ctrl + X).
The next time you reboot your Ubuntu machine, you will be greeted by the standard GDM3 login screen, requiring your secure password before granting access to the desktop environment.