Changing the password
This is the password that you have to enter when you’re logging into your account. This password isn’t the “root” password. Let’s fire up a terminal and run the following command –
This will prompt you to enter your current password. Then, you have to type your new password 2 times.
Changing the “root” password
The “root” is the ultimate user account for any Linux system that offers the most control over the system, even allowing access to sensitive system files and other files. For changing the “root” password, run the following command –
passwd
# OR
Then, restart your system.
Changing password without the current “root” access
In cases, you may not be able to access to your system because you forgot the “root” password. It’s also possible to change the password without having access to the system. Restart your system.
Keep holding “Shift” to access the GRUB menu.
Press “E” for editing the startup command.
Get to the line “linux /boot”.
At the end of “ro”, type the following text –
Press “Ctrl + X” to boot with the modified startup command. Run the following commands –
passwd
Enter your new password. After password changing is successful, run the following command for restarting your system –
Voila! Your password is changed successfully!