How to auto login on CentOS

The purpose of this tutorial is to enable auto login on GNOME GUI and the KDE Plasma desktop environment on CentOS Linux system. If you are using CentOS and getting tired of needing to provide your password every time your computer boots up, or goes back to the lock screen, then enabling auto login will save you some time and frustration.

Being presented with a password prompt when your computer first boots up is a security feature. Keep this in mind before you decide to disable it. In reality, this prompt does very little to protect your computer, and a knowledgeable attacker will be able to access your files through other means, unless the system are properly secured. Still, it is a good way to deter prying eyes in some situations.

In this tutorial, we will guide you through the step by step instructions to configure auto login for GNOME and KDE Plasma on CentOS. This can be done from either command line or GUI, and we will show the process for both methods.

In this tutorial you will learn:

  • How to enable auto login in GNOME via GUI
  • How to enable auto login in GNOME via command line
  • How to enable auto login in KDE Plasma via GUI
  • How to enable auto login in KDE Plasma via command line
How to auto login on CentOS
How to auto login on CentOS
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System CentOS Linux
Software KDE Plasma or GNOME GUI
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to enable auto login in GNOME step by step instructions




Auto login for GNOME can be configured from both GUI and command line. Follow whichever set of instructions that you find most convenient below.

Enable auto login from GNOME GUI

  1. Start by opening the Activities menu and searching for the Settings panel. Open it when you see the correct result.
    Open Settings menu on CentOS
    Open Settings menu on CentOS
  2. Inside the Settings window, click on the User tab on the left side, and then click Unlock on the upper right side in order to give your root password and have access to more settings.
    Unlock the Users tab in order to configure the settings
    Unlock the Users tab in order to configure the settings
  3. After supplying your root password, you will see an option for “Automatic login” become available to edit. Toggle this setting on, and then you can close your Settings panel.
    Enable automatic login within the Users tab inside the Settings menu
    Enable automatic login within the Users tab inside the Settings menu

Next time you boot into CentOS, you will not have to supply your password at the lock screen. Instead, you will load directly into your CentOS desktop.

Enable auto login in GNOME from command line

  1. Start by opening the GDM configuration file with nano or your preferred text editor. Be sure to do this with root permissions.
    $ sudo nano /etc/gdm/custom.conf
    



  2. Inside of this file, you will need to add the following two lines beneath the [daemon] stanza. Be sure to replace linuxconfig with the user name of the user that you wish to enable automatic login for.
    [daemon]
    AutomaticLogin=linuxconfig
    AutomaticLoginEnable=True
    
    Enabling automatic login for GNOME via the GDM configuration file
    Enabling automatic login for GNOME via the GDM configuration file
  3. That’s all there is to it. You can save your changes to this file and exit it. Next time you boot into CentOS, your user will go directly to the desktop.
    $ reboot
    

How to enable auto login in KDE Plasma step by step instructions

Auto login for KDE Plasma can be configured from both GUI and command line. Follow whichever set of instructions that you find most convenient below.

Enable auto login from KDE Plasma GUI

  1. Start by opening up the application launcher and navigating to the Settings menu under the System Tools tab.
    Open the Settings menu on CentOS KDE desktop
    Open the Settings menu on CentOS KDE desktop
  2. Navigate to the Details tab, and then to the Users pane. In this menu, you will see a button that says “UnlockK” in the upper right corner. Click that button in order to give your root password and have access to more settings.

    Unlock the Users tab in order to configure the settings
    Unlock the Users tab in order to configure the settings



  3. After supplying your root password, you will see an option for “Automatic login” become available to edit. Toggle this setting on, and then you can close your Settings panel.
    Enable automatic login within the Users tab inside the Settings menu
    Enable automatic login within the Users tab inside the Settings menu

Next time you boot into CentOS, you will not have to supply your password at the lock screen. Instead, you will load directly into your CentOS desktop.

Enable auto login in KDE Plasma from command line

  1. To configure auto login from the command line, start by opening the /etc/sddm.conf file in nano or your favorite text editor. Make sure you do this with root permissions.
    $ sudo nano /etc/sddm.conf
    

    Note that the file may not already exist, in which case we will be creating it.

  2. Within this file, copy and paste the following three lines, while replacing linuxconfig with the actual user name of the user that you wish to login to automatically.
    [Autologin]
    User=linuxconfig
    Session=plasma.desktop
    
    Enabling automatic login for GNOME via the SDDM configuration file
    Enabling automatic login for GNOME via the SDDM configuration file
  3. After you have added these changes to the file, you can exit and save your changes. The settings will take effect immediately. If you want, you can reboot the system to make sure it worked.
    $ reboot
    




That’s all there is to it. In the future, you will not be forced to provide a password at the lock screen when you boot up your computer. You can always revert these changes by following the same instructions, except unchecking the box for the GUI method or deleting the respective lines if using the command line method.

Closing Thoughts

In this tutorial, we saw how to configure auto login for the GNOME and KDE Plasma desktop environment in CentOS Linux. This setting is configurable from both command line and GUI, and is simply a matter of convenience for the user. Some users wish to sacrifice the little bit of extra security so that they do not need to type their password every time the computer boots back up. The choice is yours.