1. Home
  2. Linux

How to enable automatic login on Linux

Tired of entering your password each time you want to use Linux? Consider turning on the automatic login feature. With it enabled, you’ll be able to power on your computer and instantly log into your favorite Linux desktop environment. Turning on the automatic login feature will allow anyone to access your files and browser history. You should only enable automatic login on Linux if you don’t share a computer, and are confident that your data is safe!

Automatic Login  (LightDM)

Those not using Gnome Shell or KDE Plasma are likely using a desktop environment that makes use of LightDM for logging in. The reason for this is that the LightDM system is elegant, and offers up a reliable, customizable alternative to GDM (Gnome) and SDDM (KDE Plasma 5).

Enabling automatic login on Linux desktop environments that make use of LightDM isn’t as easy as the other desktops. You won’t be able to launch the system settings and check a button and enter a password. Instead, you must wade into the LDM configuration file and enable the autologin setting manually. Launch a terminal window and follow the steps below to set up the automatic login for your system.

Step 1: Gain a root shell using su or sudo -s.

Getting root access will allow you to quickly manipulate files in the LightDM folder without continually needing to writing sudo.

su –

or

sudo -s

Step 2: Make a complete backup of the LightDM configuration file. Creating a backup will allow you to restore to defaults if something goes wrong during the editing process.

mkdir -p /home/username/Documents/LightDM-backup/
cp /etc/lightdm/lightdm.conf /home/username/Documents/LightDM-backup/

Step 3: Open up the LightDM configuration file in the Nano text editor.

nano -w /etc/lightdm/lightdm.conf

Step 4: Press the Ctrl + W keyboard combination to bring up the search function in Nano. Then, type in autologin-user in the box. Remove the # symbol (if there’s one there).

Step 5: Next to the autologin-user line, write in your username. Be sure to write it exactly as it appears on the system. One missed character could mess up your entire LightDM configuration.

Step 6: Save the LightDM configuration file’s edits and press the Ctrl + O keyboard combination.

Step 7: Close Nano with the Ctrl + X keyboard combo.

Step 8: Reboot your Linux PC. As it turns back on, your Linux PC should automatically log into the default desktop session.

Disable automatic login for LightDM

Don’t want to use automatic login in LightDM anymore? Open up a terminal and follow the instructions below to disable it.

Step 1: Gain a root shell with sudo -s or su.

sudo -s

or

su

Step 2: Delete the lightdm.conf file in the /etc/ folder on your Linux PC.

rm /etc/lightdm/lightdm.conf

Step 3: Restore the backup file.

mv /home/username/Documents/LightDM-backup/lightdm.conf /etc/lightdm/

Step 4: Reboot your computer. Upon starting back up, automatic login will be turned off.

Automatic Login KDE Plasma 5

Setting up automatic login on KDE Plasma 5 is very user-friendly. To do it, press the Windows key on your keyboard and search for “sddm.” Click on the search result that says “Login Screen (SDDM)” to launch the KDE login configuration application.

In the KDE SDDM configuration app, look for the “Advanced” tab and click on it with the mouse.

Inside the “Advanced” section of the SDDM login area, find “Auto login” and check the box next to it to turn on the automatic login feature for SDDM. Then, click the drop-down menu next to “User” and select the user you’d like to log in automatically.

Click “apply” to confirm the settings change and reboot your KDE Linux PC. It should automatically log in at the next boot.

Disable automatic login for KDE Plasma 5

Need to disable automatic login for KDE? Press the Windows key, search for SDDM and open up the SDM login page, click on “Advanced” and uncheck the box next to “automatic login.” Select the “Apply” button to make the change permanent.

Automatic Login Gnome Shell

Using Gnome Shell and looking to set up automatic login on Linux? Follow the steps below to turn it on.

Step 1: Press the Windows key and search for “users.” In the results, look for “Add or remove users and change your password” and click on it. Doing so will launch the Gnome user manager.

Step 2: Select the “unlock” button at the top of the user manager and enter your password.

Step 3: Select the user you’d like to modify. Then, find the “automatic login” button and set it to the “on” position.

Step 4: Log out of Gnome and reboot your Linux PC. Upon reboot, Gnome Shell will automatically log in.

Disable automatic login for Gnome Shell

To disable the automatic login feature in Gnome, press the Windows key and search for “users”. Open up the user manager, and click “unlock” to enable administrator mode. Then, set the slider next to “automatic login” to the off position.

Leave a comment