Wednesday, September 28, 2011

Resetting root password in linux

In my short career as Linux system administrator , i have seen users forgetting their system's root password and thinking "ahh i have to build my system again" but fortunately the password can be reset , all it needs is a re-boot.

Note - If Grub password is set and you forget even that , no body can help you !

Here are the steps to reset it.

I will be using my RHEL system as an example.

STEP 1

Reboot your system , before it boots into the default kernel , press e to enter the GRUB menu



STEP 2

Again press e ( edit ) to see the location of the initrd image using the arrow keys select the kernel vmlinux option ( 2nd option in the screen shot below )



STEP 3

Press e gain and type s next to quite , press to go back to previous screen and type b to reboot the system



STEP 4

Now the sytem boots to single user mode , just type passwd and set your password and restart your system ( you can type init 6 here)



Now you can login with your new password .ENJOY !!!


Thanks,
vedaprasad