If you’ve ever forgotten your Linux password, chances are you’ve needed to either restore your Linux installation. Hopefully this solution will save you from having to reinstall Linux in the event that you forget your password.
Reset your Linux password using Grub:
When your machine boots into Grub, you’ll want to press “e” to edit the grub boot linux.
After pressing “e”, navigate to the kernel line and add the word “single” to the end of the long string.
Press “b” to boot into single user mode.
You should then be taken directly to a root user shell, where you can then type
passwd, and change your root password.
After you’ve reset your root password, type
reboot at the shell to leave single user mode.