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:
- Turn on your computer, and as soon as you see the Press Esc to enter grub message, press the escape key
- Select the option that says (recovery mode).
- Your PC will boot into a shell. Once you get a command prompt, type
passwd usernamewhere the username is your username. If you can’t remember your user name, then you can type
ls /homewhich should bring up the user directories (and therefore the user names). If you just enter
passwdwith no user name behind you change the root password.
- 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