Change sudo password in Ubuntu Terminal or reset root password Ubuntu. Here is how to change root password in Ubuntu using terminal.
Open Terminal and run the following command to enter sudo/superuser mode:
sudo -i
The sudo allows a permitted user to execute a command as the superuser or another user. Once you are logged in as root user; you can see that root indication in the command prompt on the terminal screen.
Now change the passwd for the root user by using the passwd command. Simply run the following command:
passwd
The passwd command changes passwords for user accounts.
A normal user may only change the password for his/her own account, while the superuser may change the password for any account. passwd also changes the account or associated password validity period.
NOTE: Password Changes The user is first prompted for his/her old password, if one is present. This password is then encrypted and compared against the stored password. The user has only one chance to enter the correct password. The superuser is permitted to bypass this step so that forgotten passwords may be changed.
The user is then prompted twice for a replacement password. The second entry is compared against the first and both are required to match in order for the password to be changed.
Then, the password is tested for complexity. Note that the passwords should consist of 6 to 8 characters including one or more characters from each of the following sets:
- lower case alphabetics
- digits 0 to 9
- punctuation marks
Now exit the root login and exit the terminal. Use the command exit.