• MainMenu
  • Home
  • Cheap VPS
  • Site Tree

Suay.Site

Another web-master's blog

  • Home
  • Cheap VPS
  • Site Tree
Loading...
X

Suay.Site

How to enable automatic login in Linux (GDM, LightDM, SDDM)

April 9, 2023

Table of contents

1. How to find out which display manager is being used

2. Automatic login to GDM

3. Automatic login to LightDM

4. How to set up automatic login in Linux with SDDM


When booting into Linux, it first starts the Display Manager, which asks us to enter a username and password, and if we enter the correct data, it starts the desktop environment.

Setting up automatic login in Linux is slightly different depending on which display manager you are using. The most popular are GDM and LightDM.

That is, setting up Linux login without a password must begin by determining which Display Manager is running.

How to find out which display manager is being used

To do this, run the command:

systemctl status display-manager.service

The following information will be displayed:

● gdm.service - GNOME Display Manager
   Loaded: loaded (/usr/lib/systemd/system/gdm.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-08-03 06:15:18 UTC; 1h 50min ago
 Main PID: 490 (gdm)
    Tasks: 3 (limit: 4915)
   Memory: 8.4M
   CGroup: /system.slice/gdm.service
           └─490 /usr/bin/gdm

авг 03 06:15:18 HackWare systemd[1]: Starting GNOME Display Manager...
авг 03 06:15:18 HackWare systemd[1]: Started GNOME Display Manager.
авг 03 06:15:27 HackWare gdm-password][737]: pam_unix(gdm-password:session): session opened for user mial by (uid=0)

Information about the display manager is contained in several places at once, for example, in the first line of “GNOME Display Manager” – this is the full name of GDM.

Thus, I have this GDM. You may have, for example, LightDM.

Automatic login to GDM

First, make sure you are using the GDM display manager:

systemctl status display-manager

Line

gdm.service - GNOME Display Manager

confirms that this OS uses GDM.

Logging into Linux with GDM (style and background images may vary on other Linux distributions):

To enable automatic login with GDM, open the /etc/gdm3/daemon.conf file:

sudo gedit /etc/gdm3/daemon.conf

Find the lines in it:

# Enabling automatic login
# AutomaticLoginEnable = true
# AutomaticLogin = user1

Uncomment the second and third lines.

Then, on the third line, replace user1 with the Linux OS username that you want to be automatically logged in. You can find out the username with the following command:

echo $USER

In my case, the username is mial, then the lines look like this:

# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = mial

Reboot – after that, you should be automatically logged in without entering a password.

Automatic login to LightDM

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

How to set up automatic login in Linux with SDDM

SDDM is an X11 and Wayland display manager based on QML.

In my Linux installations, the SDDM display manager performed better than GDM, LightDM. So if you're having trouble with other display managers, try SDDM.

Make sure that the OS uses SDDM:

systemctl status display-manager

The line

sddm.service - Simple Desktop Display Manager

confirms that SDDM is used as the display manager on this Linux.

SDDM supports automatic login using the configuration file of this display manager.

For the configuration file, you need to know the values of two variables:

  • Linux username to be automatically logged in
  • session name (which desktop environment to run)

To find out the name of the current user in the OS, run the following command:

echo $USER

In my example username:

mial

To find out the session names for X, run the command:

ls -l /usr/share/xsessions/

To find out session names for Wayland, run the command:

ls -l /usr/share/wayland-sessions/

I want to use X session, available on my system are:

  • cinnamon2d
  • cinnamon
  • gnome-xorg

From this list, I choose cinnamon.

Now we need to edit the /etc/sddm.conf.d/autologin.conf file. If this file does not exist, then create it. The /etc/sddm.conf.d/ directory may also not be present on your system. If so, then first create it:

sudo mkdir /etc/sddm.conf.d/

Now open the file for editing or create it:

sudo gedit /etc/sddm.conf.d/autologin.conf

Add the following lines to this file:

[Autologin]
User=USER
Session=SESSION

Where:

  • USER is the username
  • SESSION is the X or Wayland session

In my case it turned out like this:

[Autologin]
User=mial
Session=cinnamon

Save and close the file.

Restart your computer to verify that automatic login is now working:


Related articles:

  • How to change Display manager and login screen in Linux (90.3%)
  • How to migrate from X11 to Wayland? (90.3%)
  • How to set up automatic login in Linux with LightDM (74.9%)
  • How to set up automatic login in Linux with SDDM (68.3%)
  • How to set up automatic login in Linux with GDM (68.3%)
  • How to find the place where a photo was taken without third-party services (RANDOM - 50%)

This entry was posted in Linux and tagged in Arch Linux, automatic login in Linux, GDM, Kali Linux, LightDM, Linux Mint, SDDM, Xfce.

Alex

View more posts from this author
« How to set up automatic login in Linux with LightDM
How to set up automatic login in Linux with SDDM »
One observation on “How to enable automatic login in Linux (GDM, LightDM, SDDM)”
  1. crash bandicoot
    July 28, 2023 at 6:32 am

    in dual boot (windows-Fedora) and after stupid experiments with privacy tools, after restarting I got the following message when I tried to enter fedora: Cannot open access to console, the root account is locked. See sulogin(8) man page for more details. Press Enter to continue. apart from this, there is also a problem with grub and it gives me the following message when the laptop starts and I don't have the ability to get the operating systems when I enter the bios in the windows that are working at the moment.Grub Minimal BASH-like line editing is supported My story has other strange things, I wrote the usb with fedora in order to boot from there and fix the problem and as soon as I boot from the usb I get the following error: Invalid image, Failed to read header: Unsupported, Failed to load image: Unsupported, start_image() returned Unsupported

     
    Reply

Leave Your Observation Cancel observation

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to install any Python version for running AI models on Windows
  • How to run AI models on Windows with any Python version (a simple method)
  • How to create virtual environments with any Python version (Miniconda user guide)
  • How to create virtual environments with any Python version (Micromamba user guide)
  • How to turn images into photos using the Qwen Image Edit neural network on Windows

Recent Comments

  • Stephan Becker on How to change the language of Google Chrome and Chromium on Linux
  • Carin on dtac in Thailand: Mobile Operator User Guide
  • Alex on Menu buttons (toolbar) and status bar are missing in SMPlayer (SOLVED)
  • Alex on Error “PHP Startup: session.sid_length INI setting is deprecated” (SOLVED)
  • Shail on Error “PHP Startup: session.sid_length INI setting is deprecated” (SOLVED)

Search

Tags

Android Apache Arch Linux BlackArch BlackArch / Arch Linux computer network computer performance convert database management systems / DBMS databases DBMS Debian development file conversion file systems hardware ImageMagick IP Kali Linux Linux Mint magick Manjaro MariaDB monitor / display multimedia MySQL package managers pacman photos PHP phpMyAdmin pictures PowerShell Python software errors / problem solutions system administration Ubuntu video VirtualBox webmaster notes Web Server websites Wi-Fi Windows Windows 11

Categories

  • Blog
  • Linux
  • Money and job
  • Notes
  • PowerShell
  • Software, hardware and other IT
  • Thailand

Copyright © 2026 Suay.Site. All Rights Reserved. Capture by Slocum Studio

Scroll Up