In this practical we will learn,how to reset forgot root password in CentOS 6.x and Redhat 6.x.
We are doing this practical in CentOS 6.x and it is also applicable to Red Hat 6.x.To reset the root password we will boot the linux system in Runlevel 1 also known as single user mode.
Note: The method is applicable if grub password is not. If you have grub password set then you will not be able to follow the steps which we will describe in this post.We will discuss about grub password in next upcoming post.
To reset forgot root password in CentOS 6.x and Redhat 6.x,follow the given below steps
Step 1: Boot your CentOS/Red Hat linux system and press esc key when you see the message “Press any key to enter the menu” .
Step 2: Now select your operating system if it is dual/multiple boot.Because I have only one Operating system installed,hence selecting CentOS.Now press “e” key from your keyboard. As shown in below given screenshot.
Step 3: Now with the help of arrow key move to second line where “kernel /vmlinuz-
Step 4: Now as per given below screenshot. Only give a space and type numeric 1 . And after this press ENTER key
Step 5: Now you are back to the previous screen. Now press “b” key to boot the system and wait for a few seconds/minutes.
Step 6: Now by-default root is logged in. The runlevel is 1 (It is also known as single user mode)
Now reset the password by below given command
passwd root
After resetting the password,now restart the system by command
init 6
Step 7: Let the system get boot normally. After a short time,you will see the login screen. give your new root password and get log in.