samedi 23 juillet 2011

Forgotten the root password to your linux system


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:
OpenSUSE_boot screen
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.
OpenSUSE_mount
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.

Aucun commentaire:

Enregistrer un commentaire

Nombre total de pages vues