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
|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
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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
- 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.
- The next step is to edit the
/etc/gdm3/custom.confGDM configuration file to allow root login. Open the file in nano or your favorite text editor.
$ sudo nano /etc/gdm3/custom.conf
- Inside the GDM configuration file, we need to add the
AllowRoot=trueline. After you have made this change, you can save and exit the file.
- 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
- 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
- To make all the changes take effect, we need to reboot our Ubuntu 22.04 system.
- 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.
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.