Linux – I lost my root Password – How to reset it

I lost my ROOT user password — one of the most common issues I have see over years. Regardless if you have forgot root user password or you are taking over a system where the root user password is not documented, you can still get into the system. Here are the 3 steps to accomplish it and gain your access back to system :

Step # 1: Boot the system into single-user mode by appending the command line during boot with following: single
Step # 2: When you are presented with a command prompt, change the root user password:

# passwd root
Changing password for user root.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.

Step #3: Reboot the system and validate that the new root password works correctly

# reboot

Sometimes you can run into different problem which is that Password Change Not Available in Single-User mode. If this is case you will need first resolve the issue.

Step #1: Verify the existence of the /etc/shadow file on the sytem

 
# ls /etc | grep shadow

Step #2: If the /etc/shadow file does not exist on your system – which is good indication of the cause for this issue, use the pwconv command to re-create the /etc/shadow file on your system.

# pwconv

Step #3: Once you have fixed or resolve the issue, execute the passwd command to reset or change root user password

# passwd root
Changing password for user root.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.

Step #4: Reboot the system and try to access the system as a root with the new password to verify that the password has been changed and you have your root access back to the system.

# reboot

These are the two usual way to fix your lost or forgotten root-user password on the Linux system 🙂

Be the first to comment on "Linux – I lost my root Password – How to reset it"

Leave a comment

Your email address will not be published.


*


Get Adobe Flash player Plugin by wpburn.com wordpress themes