Enable or Disable Automatic Login in Ubuntu 20.04

With Automatic login feature enabled, a user can log in without password at the end of boot process. Conversely, we can make a user to authenticate himself/herself by disabling the feature. In this article, we would focus on how to enable or disable automatic login in Ubuntu 20.04 release.

At the end of boot process, we are provided with either a default shell or a display manager. This depends on our Ubuntu configuration. This article basically deals with display manager, a GUI login manager.

First, we need to identify the default display manager for our Ubuntu distribution. Thereafter, we would make necessary changes to get things done. We have discussed three display managers – LightDM, GDM and SDDM.

Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Identify default display manager

We can identify our default display manager using two methods –

  1. Open a terminal and issue the following –
    cat /etc/X11/default-display-manager

    This will return any of the three –

    If its LightDM

    /usr/sbin/lightdm

    GDM3

    /usr/sbin/gdm3

    and, for SDDM –

    /usr/sbin/sddm
  2. Or, to know which display manager is active and running –
    systemctl status display-manager

Once we have identified our default display manager, make changes to relevant configuration files accordingly.

Enable or Disable automatic login for LightDM

To enable automatic login – open a terminal and use any text editor for configuration file – lightdm.conf

We have used nano text editor. If the configuration file already exists then edit it. Otherwise, create a new configuration file – lightdm.conf.

sudo nano /etc/lightdm/lightdm.conf

and, append the file with –

[Seat:*]
autologin-user=<user_name>
autologin-user-timeout=0

To disable automatic login – find the above entries in the file and add # at the beginning

[Seat:*]
#autologin-user=<user_name>
#autologin-user-timeout=0

Enable or Disable automatic login for GDM3

To enable automatic login – open a terminal and use any text editor for configuration file – custom.conf

We have used nano text editor. If the configuration file already exists then edit it. Otherwise, create a new configuration file – custom.conf.

sudo nano /etc/gdm3/custom.conf

and, append the file with –

AutomaticLoginEnable = true
AutomaticLogin = <user_name>

To disable automatic login – find the above entries in the file and add # at the beginning

# AutomaticLoginEnable = true
# AutomaticLogin = <user_name>

Enable or Disable automatic login for SDDM

To enable automatic login – open a terminal and use any text editor for configuration file – autologin.conf

We have used nano text editor. If the configuration file already exists then edit it. Otherwise, create a new configuration file – autologin.conf.

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

and, append the file with –

[Autologin]
User=<user_name>

To disable automatic login – find the above entries in the file and add # at the beginning

#[Autologin]
#User=<user_name>

In conclusion, we have discussed how to enable or disable automatic login in Ubuntu 20.04 release.

Similar Posts