Introduction:
Whenever you want to perform a task on your operating system that requires root-level permissions, then you must know the root password of your system. Otherwise, you will never be able to log in as the root user. However, at times, it happens that your root password is lost or you do not know it in the first place. In this situation, you should have a mechanism for recovering your forgotten root password, or in other words, you should be able to change your root password. In this guide, we will be sharing with you the two methods of changing the root password on a Linux Mint 20.3 system.
Changing the Root Password in Linux Mint:
There are two most commonly used methods for changing the root password on Linux Mint. The first method can be used regardless of whether you have changed the root password of your system earlier or not whereas the second method can only be used if you have already changed your root password at least for once and you know it well.
Method # 1: Changing the Root Password with the “sudo” Permissions:
This method can easily be used for changing a forgotten root password or for setting up a root password for the first time. All you need to know is the “sudo” password of your system. You need to execute the following command first:
$ sudo passwd root
As soon as you will run this command, you will be asked to enter the “sudo” password of your system. After entering that password, you need to press the Enter key.
Right after entering the “sudo” password of your system, you will be asked to enter a new root password for your system as shown below:
When you will enter this password, you will be asked to re-enter it for confirmation as shown in the image that follows:
Once you will do that, a success message will be displayed to you on the terminal that will confirm that the root password of your Linux Mint system has been changed.
Method # 2: Changing the Root Password with the “root” Permissions:
This method can only be used if you know your current root password. First, you will have to execute the following command:
$ su root
When you will run this command, you will be asked to enter the current root password of your system as shown in the image below:
After adding the current root password correctly, you will gain the root permissions. Then, you will need to run the command that follows:
$ passwd
When you will execute the above-mentioned command, you will be asked to enter the new root password as shown in the image below:
After entering this password, you will be asked to re-enter it for confirmation.
Again, if both these passwords will match, a success message will be displayed on the terminal as shown in the image that follows:
Conclusion:
This guide was aimed to teach you the two methods of changing the root password of a Linux Mint 20.3 system. With the help of the first method, you can change your root password even if you do not know your current root password, however, the second method can be used only if you are well aware of your current root password.