Sponsor

it’s common that, if not you, one of your familiar or friends forget his login password, and if this is the only account available on the system this means that he’s usually locked out from his computer, luckily this is not a big issue if you have physical access to the console of a Linux system, as we can use the recovery mode available from the grub menu of most distributions (if not all).

So the first step is to reboot the system and select the Recovery Mode:

After a few moments you will see the following screen. Now select “root – Drop to root shell prompt” and press “Ok”

If you forgot your username enter this command to see all the users:

ls/home

Just remember that linux is case-sensitive about username and password, If you have upper case in your user name than you need to enter the same letters.
Now use the following command to reset your password:

passwd username

For example (See the picture above):

passwd noobslab

Now enter your new password and confirm it.
Reboot the computer with the command:

exit

That’s it, you can now login with your new password.

Is this a security issue ?
Yes and not, for Gnu/Linux systems if you have physical access to a computer you are a super-admin, and so you can use this method, or start with a live distribution to recover all the credentials of the system.
If you are worried about this you should probably set various layer of protection such as Password protected bios and grub and encrypted disk information (at least /home), perhaps these are good ideas for next articles.