Lost Linux password ? Reset it !

Have you ever been in a situation where you have lost your password and need to reset it as you want your files badly,You can easily reset passwords, though you must be careful. If a user has an encrypted home directory, you must not change the password this way! This will make all encrypted files inaccessible. You can only use this method on user that doesn’t have an encrypted home directory.

Steps:

1. Get the GRUB menu to show. It is shown by default if you have multiple OS installed, else please hold shift key down during booting to get the GRUB menu to show.

2. In the GRUB menu, highlight the OS you want to boot (if only one is installed, it is already highlighted). Then press the “e” key to edit the boot parameters.

3. Move your cursor to the end of the line similar to:

Code:
linux /boot/vmlinuz-3.2.0-23-generic root=UUID=b8080487-b557-4f55-b288-d7ef2c2b9cc1 ro   quiet splash $vt_handoff

and replace $vt_handoff with init=/bin/bash. So that it reads:

Code:
linux /boot/vmlinuz-3.2.0-23-generic root=UUID=b8080487-b557-4f55-b288-d7ef2c2b9cc1 ro   quiet splash init=/bin/bash

then press F10 to continue the boot.

4. After a little while, and some error messages you can ignore, you are now logged in on the root console without having had to enter a password. Next, run the following command to remount the / partition so you can write changes to it:

Code:
mount -o remount,rw /

5. Finally, run the following command for each user (without an encrypted home directory!) that you want to give a new password. Replace “username” with the name of the user.

Code:
passwd username

6. Then sync the file system so all changes are written to disk, and reboot:

Code:
sync
reboot -f

And, to be clear, once you have rebooted you need to login as an admin user to make changes to the system (somebody member of the sudo group). And you confirm where need with the admin’s own personal password. A standard user (not a member of the sudo group) is not allowed to make changes to the system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s