Skip to content
Follow
Ubuntu Linux

How to Enable Root User on Ubuntu 24.04

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

The root user on Ubuntu 24.04 is the supreme administrator account that has complete control over every file, setting, and program on your computer. Linux systems keep this powerful account locked by default to protect you from making mistakes that could break your operating system.

Unlocking direct root access on Ubuntu 24.04 takes just a few steps in the terminal using the sudo command to set a new password. Once you finish, you can log in directly as the root user whenever you need to manage your system.

⚡ 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

Enabling the root user on Ubuntu 24.04 begins by switching to the root account with the `sudo -i` command. Setting a strong password for the root user follows next. This credential allows direct login as the root user when administrative tasks demand it.

Run this `sudo` command.

🐧Bash / Shell
sudo -s

Terminal prompts request the current password; enter it to proceed.

Next, execute the command that configures the root user’s password.

🐧Bash / Shell
sudo passwd root

Terminal prompts require entering and confirming a new password for the root account.

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

Configuring the root user password automatically enables the account.

Executing the following command and providing the root password switches the active shell 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 operations run with the highest level of system privileges. This root status grants complete control over the entire Ubuntu 24.04 system.

💻Code
root@Ubuntu:~# 

Restrict the su command

After enabling the root account on Ubuntu, restricting who can use the 'su' command to switch users forms a sensible security practice. Limiting access to this command helps protect the operating system.

Executing the command below opens the su configuration file.

💻Code
nano /etc/pam.d/su

Uncomment the highlighted line inside 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

Save changes and exit the editor.

Granting permission to use the `su` command on Ubuntu 24.04 requires adding the target user to the `adm` group. Membership in this group permits switching to the root user, a powerful administrator account.

💻Code
usermod -aG adm richard

Configuration finishes here.

Summary:

Root access grants total control over every file and service. Treat this account with care to keep the operating system stable.

  • 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. These elevated powers permit managing protected system files, configuring network settings, and installing system-wide applications.

How to enable root user in Ubuntu 22.04 GUI?

Turning on the root user in Ubuntu 22.04 through the graphical interface requires modifying settings across 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 *