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.
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.
sudo -s
Terminal prompts request the current password; enter it to proceed.
Next, execute the command that configures the root user’s password.
sudo passwd root
Terminal prompts require entering and confirming a new password for the root account.
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.
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.
nano /etc/pam.d/su
Uncomment the highlighted line inside the file.
# 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.
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
sudocommand to set a password. - Limiting the use of the
sucommand helps prevent unauthorized access to the root account. - Always ensure that only trusted users are added to the
admgroup 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?
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.
No comments yet — be the first to share your thoughts!