In this article, we cover how to enable or disable automatic login in Ubuntu 24.04 release. If the device is located in a secure environment and we understand there wouldn’t be any potential security implications then only think of enabling automatic login. We don’t recommend you do that unless you are sure that the device is safe and secure.
Always keep in mind that this approach will pose security risks. Before we proceed, it is important to identify the default display manager we have. We cover LightDM, GDM, and SDDM here.
Note: The following operations require Administrative rights. If you lack the necessary rights to make changes to your system then, contact your System Administrator for assistance.
Identify default Display Manager
Open a terminal and identify the default Display Manager through any of the following two commands:
cat /etc/X11/default-display-manager
or,
systemctl status display-manager
For the cat command, it would come up with either of the following:
/usr/sbin/lightdm /usr/sbin/gdm3 /usr/bin/sddm
On the other hand, for systemctl status display-manager, it would return the currently active display manager service.
Once we have identified our default display manager. We need to make changes to its configuration so that we can enable or disable automatic login. We have covered all the above three display managers in a separate section below. Go through the one that applies to you.
Enable or disable automatic login for LightDM
To enable automatic log-in when LightDM is the default display manager. Create a configuration file lightdm.conf, if it doesn’t exist, through the touch command-line utility.
sudo touch /etc/lightdm/lightdm.conf.d/lightdm.conf
And, append the file with the following entries:
[Seat:*] autologin-user=<user_name> autologin-user-timeout=0
Here, replace <user_name> with the username you would want to enable automatic login.
To disable automatic login, we can put a # in front of all the entries in lightdm.conf
# [Seat:*] # autologin-user=<user_name> # autologin-user-timeout=0
Enable or disable automatic login for GDM
Edit the following configuration file:
sudo nano /etc/gdm3/custom.conf
Look for the following entries, uncomment them, and replace <user_name> with your username:
# AutomaticLoginEnable = true # AutomaticLogin = <user_name>
After removing # it should be:
AutomaticLoginEnable = true AutomaticLogin = <user_name>
To disable automatic login, put the # back.
Enable or disable automatic login for SDDM
Create a configuration file through the touch command-line utility:
sudo touch /etc/sddm.conf
And, append the file through the nano text editor with the following entries:
sudo nano /etc/sddm.conf
[Autologin] User=<user_name>
Here, replace <user_name> with your username.
To disable automatic login, put # in front of the above entries. When you wish to disable it, it should look like this:
#[Autologin] #User=<user_name>
In conclusion, we have covered here how to enable or disable automatic login in the Ubuntu 24.04 release. We must always prioritize security.