When installing Ubuntu on a personal desktop or laptop, the installation wizard offers an option to “Log in automatically”. While bypassing the login screen lets your machine boot directly to the desktop without typing your user credentials, it represents a substantial physical security risk. Anyone who powers on your computer—whether a curious colleague at work, a visitor at home, or someone who steals an unattended laptop—gains instant, unfettered access to your personal files, browser sessions, email accounts, and stored passwords. Furthermore, automatic login frequently triggers annoying “Authentication Required – Unlock Login Keyring” pop-up dialogues on startup because the system keyring remains locked until your master password is entered. Here is how to disable automatic login in Ubuntu to require a password on boot.
Why Turn Off Automatic Login in Ubuntu?
Enforcing a login password prompt at startup delivers essential security and administrative benefits:
- Workstation Physical Security: Prevents unauthorized individuals from booting into your user account and browsing private files or confidential documents.
- Eliminate Keyring Unlock Prompts: Standard password logins automatically decrypt your GNOME keyring, silencing the nagging “Unlock Login Keyring” dialogue for Chrome and Wi-Fi passwords.
- Protect SSH Keys and Credentials: Safeguards your personal
~/.ssh/private keys and developer credentials stored in your home directory. - Support Multi-User Workstations: Allows family members or office colleagues to choose their own user profiles from the display manager screen upon boot.
Method 1: Disable Automatic Login via Ubuntu Settings (Graphical)
The simplest way to enforce password authentication at boot is through Ubuntu’s system settings:
- Open the Settings application from your Applications menu or by clicking the top-right status tray and selecting the settings gear icon.
- In the left-hand navigation sidebar, scroll down and click on System (or Users on older Ubuntu releases).
- Click on Users.
- Click the Unlock button located in the top-right corner of the window.
- Enter your administrator account password when prompted and click Authenticate.
- Locate the toggle switch labelled Automatic Login.
- Toggle the switch to the Off position.
Close Settings. From your next system reboot onward, Ubuntu will halt at the GDM (GNOME Display Manager) login screen and demand your user password before granting desktop access.
Method 2: Disable Automatic Login via GDM3 Custom Configuration (Terminal)
If you manage your Ubuntu machines headlessly, run server installations, or prefer terminal commands:
- Open your terminal by pressing Ctrl + Alt + T.
- Open the GDM3 custom daemon configuration file in the Nano editor by running:
sudo nano /etc/gdm3/custom.conf - Enter your administrator password when prompted.
- Scroll down to the
[daemon]section. - Locate the following two lines:
AutomaticLoginEnable=TrueAutomaticLogin=yourusername - Add a hash symbol (
#) at the very beginning of both lines to comment them out, or changeAutomaticLoginEnable=Trueto:AutomaticLoginEnable=False - Press Ctrl + O followed by Enter to save the file.
- Press Ctrl + X to exit the Nano editor.
The configuration change is immediate. You can verify it by restarting your computer with sudo reboot.
Comparison: Automatic Login Enabled vs Disabled
| Factor | Automatic Login Enabled | Automatic Login Disabled (Recommended) |
|---|---|---|
| Boot Security | Zero security; opens directly to desktop | Password protected; locks out unauthorized users |
| GNOME Keyring | Triggers “Unlock Keyring” prompt after boot | Keyring unlocks seamlessly upon password entry |
| Multi-User Flexibility | Always boots into default user profile | Displays user selection menu on GDM display |
| Boot Speed to Desktop | Faster by 5 to 10 seconds | Requires typing user password |
Protecting Swap and Disk Encryption
While disabling automatic login protects your running user session, pairing password-protected logins with full-disk encryption (LUKS) during Ubuntu installation guarantees that your files cannot be extracted even if a thief removes your physical solid-state drive.