Let’s go over the simple commands to change the root password in Linux. Linux root refers to a special type of user account that has complete unrestricted access to the system.
Think of it as a top government security agent with a high clearance level. Usually, users are not allowed to run certain commands without root-level clearance or privilege as it is called in Linux.
Linux does this so that a user doesn’t accentually run a command that can cause unwanted loss of data. For example, a user can’t modify most of the files in the /etc directory without first gaining root or sudo permissions.
To display the current user, use the whoami command.

Using sudo to run commands as root
Sudo or ‘Superuser Do’ gives user root privileges. It is used to run a command as the root. This can be done as:
$ sudo command
After this, the system will ask the user for the password. After accepting the password the system will run the command.
Using the passwd command to change root password in Linux
To change the password we can use the passwd command.
$ sudo passwd root
After hitting enter. The system will ask you for the existing root password. Type in the password and hit enter. Now the system will ask you to pick a new password. Retype the new password two times for double-checking and press enter.

Output window will inform you upon performing a successful update.
Changing a user’s password
As a root user, you can change the password of other users in the system. Knowing the name of the user is sufficient to change the password.
$ passwd user

In this example, I have created a user and changed the password for the user. I was able to do this without sudo as I am currently the root.
A user can change their own password without root privileges.

Note that the new password and the old password can’t be similar.
Conclusion
Linux requires normal users to use sudo to get root privileges. Linux protects users from making serious unwanted errors by giving certain permissions only to the root user. Access to the root user is password protected. Sudo command gives access to change the root password.