So this happens, on occasion, you may forget your Ubuntu password. Screwed right? Not really. There are ways you can reset root password in Ubuntu. Just read along, I'll provide you solutions. We will do this in 3 different ways.
How To Reset Root Password In Ubuntu?
OPTION 1 - ROOT SHELL METHOD 1
This will list all the user accounts in your system.
5. To reset the password, type passwd username where username is the username you want to reset, for example -
6. You'll then be prompted for a new password. Type your new password and then hit Enter.
NOTE: When you type the password, nothing will appear to indicate your typing. You'll be prompted to retype the password. Repeat your password and hit Enter again.
7. Now the password should be reset. Type exit to return to the recovery menu.
8. After you get back to the recovery menu, select resume normal boot, and your new password should work now.
OPTION 2 - ROOT SHELL
OPTION 3 - LIVE DISC OR USB
sudo mount /dev/sda1 /mnt
5. Cross-mount things from the Live install so we can "use" the mounted disk (just copy and paste):for d in dev sys run proc; do sudo mount --bind /$d /mnt/$d; done
6. Become root on the system by running -
sudo chroot /mnt
You can now do anything root can on the real install.
7. Set the password for the account with: passwd username
8. Reboot and you are done
So this is how easy it is to reset root password in Ubuntu. You could also use some recovery CDs. Check out this post. Please take note that this poses a sort of a security problem as someone could easily change your password and access your private files. You should be careful who you allow access on your PC. Hope you find this post useful. Share your thoughts with us in the comments.