Recover Linux Account when You Forgot the Password

If you have a Linux machine and forgot the password you set during the installation process or if one of your friends gave you his old computer including a Linux installation without giving providing you his user name and password you can use this tutorial to help you to recover the account by setting a new password:

  1. Turn on your computer, and as soon as you see the Press Esc to enter grub message, press the escape key [ESC].
  2. Select the option that says (recovery mode).
  3. Your PC will boot into a shell. Once you get a command prompt, type passwd username where the username is your username. If you can’t remember your user name, then you can type ls /home which should bring up the user directories (and therefore the user names). If you just enter passwd with no user name behind you change the root password.
  4. Enter a new password when prompted, and again when prompted again. Now you continue with normal boot and that’s it. You should now be able to login with your new password