Skip to content
Follow
Ubuntu Linux

How to Enable Root User on Ubuntu 24.04

Richard
Written by
Richard
Feb 27, 2025 Updated Jul 13, 2026 3 min read
How to Enable Root User on Ubuntu 24.04
How to Enable Root User on Ubuntu 24.04

Enabling the root user on Ubuntu 24.04 lets you run commands with full system control without needing `sudo` for every action.

The root user, also known as the superuser, has unlimited power over your Ubuntu system. This means you can change any file or run any command directly.

By default, Ubuntu 24.04 keeps the root account locked. This is a safety feature that makes you use `sudo` for specific administrative tasks, which is safer for everyday use.

You can choose to unlock direct root access for certain situations. This guide shows you how to set a password for the root account on Ubuntu 24.04.

⚡ Quick Answer

Set a password for the root account using `sudo passwd root`. Then, switch to the root user with `su -`. This grants full administrative privileges to your Ubuntu system.

Enable root

To enable the root user on Ubuntu 24.04, begin by switching to the root account with the `sudo -i` command. After switching, set a strong password for the root user. This strong password allows direct login as the root user when administrative tasks are necessary.

Run this `sudo` command.

🐧Bash / Shell
sudo -s

Your password will be requested; enter it when prompted.

Next, run the command to set the root user’s password.

🐧Bash / Shell
sudo passwd root

When prompted, enter and confirm a new password for the root account.

💻Code
New password: 
Retype new password:
passwd: password updated successfully

With the root user password set, the account is automatically enabled.

Run the following command and enter the root password to switch to the root user.

The root user prompt on Ubuntu 24.04 displays "root" at the beginning and "#" at the end. This visual cue confirms you are operating with the highest level of system privileges. This root status gives complete control over the entire Ubuntu 24.04 system.

💻Code
root@Ubuntu:~# 

Restrict the su command

After enabling the root account on Ubuntu, it is good practice to restrict who can use the ‘su’ command to switch to other users, especially root. This limits access, helping to keep your system secure.

To do that, run the command to open the su config file.

💻Code
nano /etc/pam.d/su

Uncomment the highlighted line in the file.

💻Code
# Uncomment this to force users to be a member of group adm
# before they can use `su'.
auth required pam_wheel.so group=adm

Exit and save.

To allow a user permission to use the `su` command on Ubuntu 24.04, add that user to the `adm` group. This action permits the user to switch to the root user, a powerful administrator account.

💻Code
usermod -aG adm richard

That should do it!

To wrap up:

The root user account on Ubuntu 24.04 provides powerful administrative capabilities. Proceed with caution to ensure system security when using this account.

  • The root account offers full administrative access and can perform any task on the system.
  • By default, the root account is disabled to enhance security.
  • You can easily enable the root account using the sudo command to set a password.
  • Limiting the use of the su command helps prevent unauthorized access to the root account.
  • Always ensure that only trusted users are added to the adm group to maintain system integrity.
  • Regularly review user permissions and access to the root account to ensure ongoing security.

What does enable root account mean?

Root privileges allow operation without system boundaries, presenting both advantages and security risks. With these powers, you can manage protected system files, configure network settings, and install system-wide applications.

How to enable root user in Ubuntu 22.04 GUI?

To turn on the root user in Ubuntu 22.04 using the graphical interface, change settings in two system files.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install Additional Software on Ubuntu
Ubuntu Linux How to Install Additional Software on Ubuntu
Enable or Disable 'Switch User' in Ubuntu Linux
Ubuntu Linux Enable or Disable 'Switch User' in Ubuntu Linux
How to Restore 'Run as Different User' in Windows 11
Windows How to Restore 'Run as Different User' in Windows 11
How to Enable UAC Administrator Display in Windows 11
Windows How to Enable UAC Administrator Display in Windows 11

No comments yet — be the first to share your thoughts!

Leave a Comment

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