Resetting a Lost Root Password
So, you forgot your root password and would like to gain access to your system again. Don’t worry, all is not lost. You can use the SuSE Linux install cd to boot the ‘Rescue System’, reset the password and create a new one. Special thanks to Broch, whom originally posted this information on the SuSE Linux Forums. I decided his orignal post was nice for the Linux proficient, but a bit of a trial for newbies. I believe that anyone asking a newbie to use vi is a saddistic bastard. So without further adieu, here is Broch’s post, vi free and newbie friendly.
- Disconnect computer from the network (you will work with root privileges)
- Boot from your first install CD/DVD and press F1 at the first screen, then choose “Rescue System” from the menu and at the prompt type:
- # root (You do NOT need a password)
- Next at the prompt enter:
#cd /etc
#pico -w passwd - In the passwd file look for root line (something like):
root:x:0:0:root:/root:/bin/bash - Delete the “x” after “root:” leave the colons!
- After the modification above line should look like this:
root::0:0:root:/root:/bin/bash - Exit Pico, Saving Changes with Ctrl+X
- Next edit the shadow file by typing:
# pico -w shadow - Change the root line from something like:
root:$2a$05$sin5i458ghsdfg8076t5ymp4y;jgslkdbvffdbshmRK:12856:0:10000::::
to
root:::: (note four colons left) - Exit Pico, Saving Changes with Ctrl+X
- Now, reboot your computer, login as your normal user
- from a console window enter:
# su
# passwd - Set the new root password and you should be good to go.
*note* If you wish to reset a user’s password, simply login as root, and type:
# passwd user_name


There is an easier way…
1. Boot from you Linux CD.
2. Type “root” in login prompt.
3. Create some temp dir, for example “md /mnt”.
4. Mount partition where your SuSE is, “mount /dev/hda1 /mnt”.
5. Change your root dir to there, “chroot /mnt”.
6. Execute standard changing password command, “passwd”.
7. Type new passwords there…then reboot.
That’s all