Skip to content
Follow
Ubuntu Linux

How to Enable Root User on Ubuntu 24.04

Richard
Written by
Richard
Feb 27, 2025 Updated Mar 20, 2026 2 min read
How to Enable Root User on Ubuntu 24.04
How to Enable Root User on Ubuntu 24.04

You enable the root user on Ubuntu 24.04 by setting a password for the root account.

The root user, also known as the superuser, possesses complete administrative control over your Ubuntu system. This means you can execute any command and modify any file without prefixing commands with `sudo`.

Ubuntu 24.04, like other distributions, disables direct root login by default. This security measure encourages the use of `sudo` for individual administrative commands.

However, if you require direct root access for specific tasks or workflows, you can enable it with a few straightforward commands.

⚡ 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

You can enable the root user on Ubuntu 24.04 by first using a sudo command to switch to the root user.

Go ahead and run this `sudo` command.

🐧Bash / Shell
sudo -s

You’ll be prompted for your password, so type that in.

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 command below and type the root password to switch to the root user.

💻Code
su -

You’ll know it’s the root user when the prompt begins with root and ends with #.

💻Code
root@Ubuntu:~# 

Restrict the su command

After enabling the root account, it’s smart to limit who can use the ‘su’ command to switch to other users, including root.

To do that, run the command below 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.

Then, add the user who should be allowed to use the su command to the [adm] group.

💻Code
usermod -aG adm richard

That should do it!

To wrap up:

Enabling the root user account on Ubuntu 24.04 gives you powerful administrative capabilities. However, it is important to proceed with caution to ensure system security. Here are the key takeaways:

  • 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 let you operate without system boundaries, offering 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, you’ll 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
How to Install Let's Chat on Ubuntu Linux
Ubuntu Linux How to Install Let's Chat on Ubuntu Linux
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

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

Leave a Comment

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