Recover root password

It happens sometime that you can't remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
This tutorial will show how to boot Linux in single user mode when using GRUB and finally how to change root password.

During normal usage, a Linux OS runs under runlevels between 3 and 5 which correspond to various multi-user modes. Booting Linux under runlevel 1 will allow one to enter into a specific mode, single user mode. Under such a level, you directly get a root prompt. From there, changing root password is a piece of cake.

01. Start your PC at the boot loader press the space bar before 5 seconds

02. Press “p” and give the boot loader password

03. Press “a” to modify the kernel arguments before booting

04. At the end of the line add the word single or 1
grub append> ro root=/dev/lvm/logvol01 rhgb quiet 1

05. It will be logged on as root user

06. Change the root password (As root, changing password does not ask for your old password, therefore running the command :)
#passwd

------------------------------------------------------------------------------------------

0 comments: