Enable automatic login in Ubuntu Linux Systems via command line, follow the steps given below.
Automatic login, also known as auto-login is a way to login directly (automatically) without entering a password at the login screen. When automatic login is enable you won’t have to type your password at the time you log in.
Enable Auto-Login in Ubuntu – GUI Method
To enable auto-login on Ubuntu 23.04, Ubuntu 22.04 and other Ubuntu flavors, go to “Settings” -> “System” -> “Users”, then click on the “Unlock” button and type your login password to authenticate. Finally, turn on the “Automatic Login” option for the current user.
- Open the Activities overview and start typing System.
- Select Settings > System from the results. This will open the System panel.
- Select Users to open the panel.
- Press Unlock in the top right corner and type in your password when prompted.
- Finally, turn on the “Automatic Login” option for the current user.
- If it is a different user account that you want to log into automatically, select the account under Other Users.
- Switch the Automatic Login switch to on.
This will activate the auto-login feature for the current user. However, if you want to enable the auto-login for another user, scroll down to the “Other Users” section on the “Users” page. Select the preferred user for auto-login, which will lead you to their user page.
There, click the “Unlock” button, enter the current user login password (for me, it’s Ubuntu Shell) for authentication, and enable the “Automatic Login” option for that user.
Enable Auto-Login in Ubuntu – Commandline Method
Ubuntu users can enable auto-login by editing the config file. gdm3 is the default display manager your Linux Ubuntu system (for the official Ubuntu variant).
Whereas LightDM is used in XUbuntu, Ubuntu MATE, Ubuntu Cinnamon, and Ubuntu Unity and SDDM for KUbuntu, Ubuntu Studio, and LUbuntu Systems.
You can run the following command to find the default display manager currently in use on your Linux system:
$ systemctl status display-manager
Enable Auto-login for gdm3 – Ubuntu Systems
Follow the steps given below to enable auto-login for the gdm3 display manager used on Lunux Ubuntu GNOME Desktop:
- Open the terminal and execute the following command to modify the config file:
$ sudo nano /etc/gdm3/custom.conf
- Once the config file is open, you need to find the following lines within the “[daemon]” section, then remove the “#” prefix to uncomment and replace “USERNAME” with the desired user for enabling auto-login.
AutomaticLoginEnable = true
AutomaticLogin = USERNAME
After you finish, save and close the file, then reboot your system to see the changes.
Disable Automatic Login For a User
To disable automatic login for a certain user, you can simply comment out(add a # character) the lines in the custom.conf lines where AutomaticLoginEnable=true and Automatic Login=[user1] has been specified. Once done, save the file by pressing Ctrl+X and then Y.
That’s all to disable the automatic login for a user. So when you restart the computer, the specified user will be asked to login using their credentials, just like the normal method.