This article covers the process of changing the root password in Ubuntu Linux.
Table of Contents
- Types of Users in Linux
- Root User
- Sudo User
- Normal User
- How to Change Root Password in Ubuntu Linux?
- Can Root User Change Sudo User Password
- Can Normal User Change Root User Password
- Can Sudo User Change Root User Password
- Conclusion
Types of Users in Linux
Linux systems have three different user types: root user, normal user, and sudo user.
Root User
Among all users, root has the highest level of privilege in Linux. All system files and directories are accessible to this user, and any action can be performed without restrictions. It is recommended to use the root user only for system administration tasks, and not for regular use.
By default, the root account is disabled in Ubuntu Linux, and users are required to use the sudo command to execute administrative tasks.
Sudo User
The sudo user is a user who has been granted temporary administrative privileges to perform system-wide tasks. A sudo user can execute specific commands with administrative privileges by providing their password. This is a secure way to provide temporary administrative privileges without having to give the user full access to the system.
Normal User
A normal user is an account created for a regular user to perform daily tasks on the system. These users have limited permissions and cannot make system-wide changes. They are not authorized to perform administrative tasks like installing software, changing system settings, or modifying system files.
How to Change Root Password in Ubuntu Linux
To change the root password using Terminal, follow the steps below:
Open the terminal by pressing Ctrl + Alt + T or searching for Terminal in the application menu.
First switch to the root user from sudo user using the following command:
Enter root user current password.
Now to change the root user password, run the passwd command. This command will ask the user to type a new password.
After that retype the new password.
If both new passwords matched, we would see the password updated successfully on the screen.
Now switch back to sudo user.
Re-enter the root user by typing su:
Now enter a new password for root. If the password was successfully changed you will enter the root user. Type exit to leave the root user.
We have successfully updated the root user password using the terminal.
Can Root User Change Sudo User Password
Yes, it is possible to modify the sudo user password by a root user. The root user has full system privileges and can perform any administrative task on the system, including changing the passwords of other users, including those with sudo privileges.
To sudo the user password, enter the passwd command followed by the username of the sudo user.
For example, to change sudo password for the user named kash, run the given command:
You will then be prompted to type the new password.
Once you have entered and confirmed the new password, it will be updated in the system, and the user can use the new password to authenticate and perform administrative tasks with sudo privileges.
To confirm the password change run any command that requires sudo user password authentication such as apt update.
Can Normal User Change Root User Password
By default, a normal user does not have the necessary privileges to change the password of the root user on a Linux system. This is because the root user has full control over the system and its configuration, and allowing a regular user to change the root password could potentially compromise the security of the system.
For example, if we try to update the root user password from a normal user the following response will be prompted.
Can Sudo User Change Root User Password
Yes, sudo users can change the password of the root user. For example, to change the root user password, run the following command:
Now switch to root user to confirm the password change.
Note: If the sudo user does not have permission to change the root password, then they can still use the sudo passwd command to change their own password or the password of another non-root user on the system.
Conclusion
The passwd command can modify the root user password in Ubuntu Linux that is used. Changing the root password will help to make your system more secure. A root user can modify or change the password of any user across the system. However, a sudo user can also modify the root user password. For a detailed description read the article.