How to allow GUI root login on Ubuntu 22.04 Jammy Jellyfish Linux

By default, the root user is not able to log in to the GUI on Ubuntu 22.04 Jammy Jellyfish. This is a security feature and it is common convention to only start a desktop environment as an unprivileged user. However, on test systems and in edge scenarios, it can be useful to log in to the GUI as the root user.

In this tutorial, you will learn how to log in to the GNOME desktop environment as the root user on Ubuntu 22.04 Jammy Jellyfish. Follow our step by step instructions below to implement this configuration.

In this tutorial you will learn:

  • How to set root password
  • How to configure GDM to allow root gui login
  • How to configure PAM to allow root gui login
Allow GUI root login on Ubuntu 22.04 Jammy Jellyfish Linux Desktop
Allow GUI root login on Ubuntu 22.04 Jammy Jellyfish Linux Desktop
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 Jammy Jellyfish
Software GNOME desktop environment
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

Allow GUI root login on Ubuntu 22.04 Jammy Jellyfish step by step instructions



  1. By default, the root user does not have a set password on Ubuntu 22.04. So the first thing we need to do is open a command line terminal and set a password for root with the following command.
    $ sudo passwd
    

    The above command will allow us to set a root password which will be later user to login to GUI.

  2. The next step is to edit the /etc/gdm3/custom.conf GDM configuration file to allow root login. Open the file in nano or your favorite text editor.
    $ sudo nano /etc/gdm3/custom.conf
    
  3. Inside the GDM configuration file, we need to add the AllowRoot=true line. After you have made this change, you can save and exit the file.
    AllowRoot=true
    
    Editing the GDM configuration file to allow root login
    Editing the GDM configuration file to allow root login
  4. Next, we need to edit the PAM authentication daemon configuration file located at /etc/pam.d/gdm-password, so once again open this file with nano or your preferred text editor.
    $ sudo nano /etc/pam.d/gdm-password
    
  5. Inside of the PAM authentication daemon file, comment out the following line, which denies root access to the graphical user interface, with a pound sign #. You can save your changes and exit this file when done.
    auth   required        pam_succeed_if.so user != root quiet_success
    
    Comment line which denies root’s access to graphical user interface
    Comment line which denies root’s access to graphical user interface
  6. To make all the changes take effect, we need to reboot our Ubuntu 22.04 system.
    $ reboot
    
  7. Upon loading back into Ubuntu 22.04, you should now be able to log in as root in the graphical user interface. Select the Not listed? option and enter root’s credentials to log in.



    Enter root's credentials and log in to GNOME GUI
    Enter root’s credentials and log in to GNOME GUI

Closing Thoughts

In this tutorial, we saw how to enable root GUI login on Ubuntu 22.04 Jammy Jellyfish Linux. This works specifically for the GNOME desktop environment, although it requires us to edit a few configuration files since this is not a recommended practice. It is simple enough to reverse the changes you made if you need to once again disable root GUI login at a later date.