Reset forgotten/lost main user password in Linux

reset password 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.

  1. Restart Ubuntu, then long press shift into the grub menu, select recovery mode, do not press Enter

  2. Press the “e” button to enter the edit page; as follows (recovery mode)
  3. 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

  4. Press Ctrl + x into single-user mode, the current user is root
  5. To modify the /etc directory sudoers permissions: chmod 0440 sudoers, type passwd root to change root password
  6. Press Ctrl + alt + del  to restart.
  7. Done!