Learn how to reset forgotten root password of Red Hat (RHEL 5) in Run level 1. This is my first post in my blog. The question always ask by student is how to reset root password in Linux if they forgot the password. This is not a big task to reset root password if grub password is not set. Here I am trying to give my best way to tell how to reset root password in Red Hat Enterprise Linux 5.x
Reset Root password in runlevel 1
In this section, we will reset the root password in runlevel 1.
1. Start/Restart The Machine
Start your Machine/PC and press any key when the Linux O.S is just started. You will get a first red colour screen with showing countdown time in seconds. When you will press any key you will get a screen like below given picture.
2. Edit The Kernel Level
Now press key “e” from your keyboard. (Note: If your system has 2 or more O.S then select the “Red Hat Enterprise Linux Server” option as you are getting on above picture and then press key “e”)
After pressing “e” key you will get the screen like this(see below picture)
Select option “kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quit”.And press again key “e” from your keyboard.
From above lines, “2.6.18-8.el5” is Linux kernel version. So don’t get confused it vary if you are using different version of Red Hat Linux.
After that you have to only type 1 with space. And then press ENTER from your keyboard.(See the below picture)
3. Boot The Machine After Editing Runlevel
After that, you will be by-default back to your screen .Now you have to press key “b” from your keyboard. The system will go for booting in runlevel 1.
4. Reset Root Password
After booting you will get a black screen.Now here we go to change the root password.
For changing the password.We will use command “passwd” .
sh-3.1#passwd
After using this command it will ask you to type and retype the password of root.Type your desired password.(linux do not show anything while typing any user password so do nt get confused)
After giving your password reboot your system.
For rebooting type command “init 6”.
init 6
5.Login To Red Hat Linux Machine
Now login with new root password. You will be able to login in both Terminal and GUI.
Note: The above screen shows when the Linux operating system is running in run level 5.
thanks
its great
Welcome sasan
Thanks for this blog. very helpfull
Thanks sharad, It worked for me..thanks a ton…