Reset forgotten/lost main user password in Linux
On the situation, you were forgotten/lost main user password in Linux, you can enter the single mode to modify the root password.
I’m going to guide you to reset the password, I use Ubuntu for this tutorial.
- Restart Ubuntu, then long press shift into the grub menu, select recovery mode, do not press Enter
- Press the “e” button to enter the edit page; as follows (recovery mode)
- replace the recovery nomodeset to rw single init=/bin/bash
(Note: If it is non-recovery mode, change the ro single to rw single init=/bin/bash)
- Press Ctrl + x into single-user mode, the current user is root
- To modify the /etc directory sudoers permissions: chmod 0440 sudoers, type passwd root to change root password
- Press Ctrl + alt + del to restart.
- Done!