Typically, users must provide authentication information to log on to the Linux system. This helps protect any confidential or personal files, emails, and other data in your system from any physical intrusion. However, if your system is in a safe place, free from any kind of privacy risk, you can avoid the hassle of providing user credentials every time you log in. This article introduces the following two ways to enable / disable automatic login. to your Ubuntu system:
- Through the command line.
- Through a graphical interface.
Please note that this tutorial is used on the Ubuntu 18.04 LTS (Bionic Beaver) system.
Enable / disable automatic login via command line
As a superuser, you can enable automatic login for yourself or any other Ubuntu user by making some changes to the configuration of the custom.conf file as follows:
- Open Terminal via Ubuntu Dash or by clicking Ctrl + Alt + T,
- Open custom.conf file in the Nano editor using the following command:
$ sudo nano /etc/gdm3/custom.conf
Please note that you need to be superuser to edit most system configurations.
When you enter your password, the following file will open:
In this file, the highlighted lines were commented out. We can determine the commented out line by the presence of the # character at the beginning of the line. The interpreter ignores commented lines when reading the configuration file. This means that in our file the automatic login function for user user1 is disabled.
Enable automatic user login
You can simply remove the # character from the last two lines we selected and specify the username instead of the “user1” value for the user whose automatic login you want to enable.
In this tutorial, we replaced the value of user1 with sana. You can see the color change of the included function.
Now save the file by clicking Ctrl + X and then Y,
Now, when you restart the computer, the specified user will log in without asking for any authentication information.
Disable automatic user login
To disable automatic login for a specific user, you can simply comment out (add # character) the lines in the custom.conf lines, where AutomaticLoginEnable = true and Automatic Login =[user1] has been indicated.
You can see the color change of the disabled function. Save the file by pressing Ctrl + X and then Y. Now, when the computer restarts, the specified user will be asked to provide authentication information for entering the system.
Enable / disable automatic login via graphical interface
You can enable / disable automatic login for yourself or any other Ubuntu user through the graphical interface as follows:
Click the down arrow located in the upper right corner of the Ubuntu screen, and then click your username. The following options will be displayed:
Select Account settings option.
The following Users dialog box appears. Since you need to be superuser to configure these settings, the auto-login button will be disabled by default. Click the “Unblock” button located in the upper right part of the dialog box to enable this button.
Enter the authentication information in the following dialog box and click “Authentication”:
Now you can switch the automatic login button to the OFF or ON position depending on whether you want to enable or disable automatic user login.
When you restart your computer, the authentication procedure at login will depend on your choice
Following the simple steps described in this guide, you can enable / disable the automatic login feature for yourself or other users (as an administrator). Thus, you can establish secure access to your computer depending on your needs.
How to enable / disable automatic login in Ubuntu 18.04 LTS