Forgotten the root password to your linux system? Don’t want to reinstall and lose your files or are you just plain lazy? Here is an easy way to reset the root password if you ever find yourself in that situation.
I must admit, I was surprised how easy it was. I had an old test box at home, and was too lazy to rebuild it so I did a bit of searching on the internet. What I describe below worked on OpenSuse 11.2, 11.3 and also 10.3.
For other distros and version, I cannot guarantee that it will work. But please leave a comment at the end of the post to let me and others know.
Turn the computer on and select the normal boot menu from the list:
Once selected, tab down to the “Boot Options” box and type in the following:
init=/bin/bash if you are using GRUB Boot loader
linux init=/bin/bash if you are using LILO Boot Loader
If you are not sure what sort of bootloader you are using (and I certainly didn’t), I did notice that just before the boot screen appeared there flashed a quick message indicating the grub bootloader was there.
This will throw you straight into a Bash shell prompt which comes up even before the Single User mode loads and has the “/” root file system mounted. How cool is that?
Do a mount command to check if the root file system “/” is mounted as Read-Write.
If you notice the screenshot below, you will see that mine was mounted.
Next, simply type the passwd command and enter a new password (as per below):
opensuse_linux:~ # passwd
Changing password for root
New Password:
Reenter New Password:
Password changed
Type in reboot and that’s pretty much it:
opensuse_linux:~ # reboot
Now, if you’re thinking that your system in insecure because you can change the root password so easily, bear in mind that you will need physical access to the box in order to perform the above. Furthermore, you can secure things a bit by password protecting the BIOS of even the bootloader if so desired.
Hopefully, the above will work for you and save you a bit of heartache if you forget/lose your root password.
Hi,
I have recently forgotten my root passwd for my SUSE 10.1 box and tried changing it in the single user mode but unfortunetely the keyboard is getting disabled so i m able to type nothing…
Im now clueless, please help me wat could be done..
Thanks
dee
pradeep.aleti@gmail.com
hi,
it’s coming command not found
Hi,
At what stage is it coming up ‘command not found’? Also, what version of Suse are you running?
Dee, are you able to type anything? Try hitting the TAB key before typing.
Worked for me on Opensuse 12.2! Thank you very much!!!