
How to set up automatic login in Linux with LightDM
April 9, 2023
First, make sure you are using the LightDM display manager:
systemctl status display-manager
Line
lightdm.service - Light Display Manager
confirms that this OS uses LightDM.
Logging into Linux with LightDM (style and background images may vary on other Linux distributions):
To automatically login to LightDM, open the configuration text file /etc/lightdm/lightdm.conf:
sudo gedit /etc/lightdm/lightdm.conf
Find the [Seat:*] section there (or it may be called [SeatDefaults]), and in this section there are two commented lines:
#autologin-user= #autologin-user-timeout=0
Uncomment them (remove the # symbol at the beginning of the line), and after autologin-user enter the username for which automatic login should be performed, for example, if this is the root user, then the lines look like this:
autologin-user=root autologin-user-timeout=0
If you do not know or have forgotten the username of the Linux system, then you can find it out by running the command in the terminal:
whoami
If the lightdm.conf file does not exist at all, then create it:
sudo gedit /etc/lightdm/lightdm.conf
Copy to this file:
[Seat:*] autologin-guest=false autologin-user=mial autologin-user-timeout=0
Note the autologin-user directive and the username that follows it, “mial”. You, of course, need to replace this name with your own system username.
Now open the /etc/pam.d/lightdm-autologin file:
sudo gedit /etc/pam.d/lightdm-autologin
Find the line there:
auth required pam_succeed_if.so user != root quiet_success
and replace it with:
auth required pam_succeed_if.so user != anything quiet_success
Reboot – after that, you should be automatically logged in without entering a password.
If it does not work, to check if the settings from the lightdm.conf configuration file are applied, run the command:
/usr/sbin/lightdm --show-config
Related articles:
- How to enable automatic login in Linux (GDM, LightDM, SDDM) (100%)
- How to connect a TV to a computer in Linux in Xfce (Kali Linux, Xubuntu) (63.1%)
- How to set up automatic login in Linux with SDDM (62.3%)
- How to set up automatic login in Linux with GDM (62.3%)
- How to disable window grouping in Xfce (59.9%)
- Error “TypeError: 'AURPackageInfo' does not have attribute 'submitter'” (SOLVED) (RANDOM - 50%)