Thursday 2 June 2016

How to reset lost admin password in Ubuntu

Sometimes, when you manage more than one OS, forgetting the username/password creates a lot of trouble for you. You want to login to your Ubuntu system and you can't remember the password. Also, when you are the admin of the a Linux Ubuntu systems that's being shared by other users, the chances of some user forgetting their login credentials are more and in that case, you will need to reset that too. 

This tutorial will help you to reset Admin password in Ubuntu if you have forgotten it. 

The first step is to boot up your Ubuntu System and as the BIOS screen shows up, press Shift key for the GRUB menu. In case you are dual booting your Ubuntu with Windows or Mac, you won't need to press the Shift key and the screen opens up with the Grub menu by default. 

The GNU GRUB menu will look like this. 

Open your Linux Ubuntu in recovery mode by selecting the second option from the list that will read something like this: 

Ubuntu, with Linux 3.16.0-37-generic (recovery mode).

The next screen will be the recovery menu. Scroll down to root - Drop to root shell prompt and press Enter. 

Now, you will have the root prompt but in read only mode. You will need to remount it with writing permissions. Type this command in the prompt:

mount -rw -o remount /

Now you can easily reset the forgotten password with the passwd command. Say, my username is hax0r and I want to reset it's password. 

passwd hax0r
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Once done, reboot your system and login with the new password you have just reset. To reboot, type exit to return to recovery menu and select resume normal boot to boot in your Ubuntu system. 

Now, if in case the user do not remember even the username, type in ls /home at the root prompt to get the list of users and follow the above procedure for changing the password in Ubuntu. 

Hope this tutorials helps to reset lost Admin password in Ubuntu. If you have anything to add, let me know in the comments. 


Post a Comment