Header Shadow Image


Linux Administration: Resetting the root password when forgotten.

So you've lost the password to the root account.  Worst, you've had a boot password and it was the same.  Here are some instructions on how to get back into your system:

Create a user on another Unix / Linux operating system.

# useradd resetrootpass

then set the password on the new user:

# passwd resetrootpass

once password is set, edit the /etc/shadow file and copy the encrypted password text:

# cat /etc/shadow
resetrootpass:$1$4K5.hqbH$lKPzvk8qbmBaK9TJi0p0:11675:101:88888:3:::

to the /etc/shadow root's password field on your OS where you've forgotten your password too (You may need to use a boot CD like a Linux Live CD to mount the system with then mount the partition to get access to the /etc/ folder).

Once you replace the root's encrypted string with the new one you created above for an arbitrary user, you should be able to boot and login with the new password.

Cheers!
TK

Leave a Reply

You must be logged in to post a comment.


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License