In this tutorial we will learn,recover Linux Grub Password in linux rescue mode CentOS/Red Hat.We are doing this practical with scenario,in case we forgot root as well as grub password.The method will help you to recover linux grub boot loader password.

Requirement: We prefer to use bootable CentOS/Red Hat CD/DVD/USB which is used for installing Operating System.

Recently, we have already published about two posts,we suggest you to also read these posts:

(1)Resetting forgotten root password in Runlevel 1
(2)To set grub password to protect resetting root password in runlevel1

Follow the given below steps to recover linux grub password

Step 1: Get the CentOS/Red Hat bootable CD/DVD/USB media.And insert the media into system.It is obvious for CD/DVD use CD/DVD ROM and for USB devices use USB port in system.

Step 2: On booting you will see some options on screen.Use any one method given below:

Select “Rescue installed system” and hit enter.

OR

Alternatively, you can also press TAB key and add the word “linux rescue” and hit enter.

See the screenshot of both method. Do not worry, after this all steps are same.

grub linux rescue

linux rescue command

Step 2: Now choose the language as you have in Operating system. I have selected english.

rescue linux grub password

Step 3: Select your keyboard type

rescue linux grub password

Step 4: Now you will see “Setup Networking” screen.It is optional,as per your requirement select Yes or No. I have selected yes.

rescue linux grub password

Step 5: Because we have selected Networking Yes. Now select which interface you want to enable.

rescue linux grub password

Step 6: In “Enable Network Interface” screen.Either you can select DHCP or static. If you have IPV6 in your network, you can also select that option. In static option,give the IP information as you have.

rescue linux grub password

Step 7: Now you will get “Rescue” screen. Now the rescue environment will mount your operating system in /mnt/sysimage. It means we can find our grub.conf file in /mnt/sysimage ,once we get into rescue environment shell

Note: If you do not select networking in Step 4,you will directly see this screen.

rescue linux grub password

Step 8: In next screen,you will get the message,”The system has been mounted under /mnt/sysimage” . Select OK.

rescue linux grub password

rescue linux grub password

Step 9: Now select shell and OK. See the given below screenshot.

rescue linux grub password

Step 10: In given screenshot, I have run two commands to show who is current user login and where the system filesystem has been mounted.
Hence,the user is root and we can see the boot is mounted under /mnt/sysimage/boot .

rescue linux grub password

Step 11: Important note here,in this practical I have used the command chroot /mnt/sysimage. You can run this command.It helps to reboot the system when you hit exit command . If you do not run chroot /mnt/sysimage command then when you hit exit command,you will be back to previous screen (as we have seen a step ago) and after this you have to select reboot option to restart the system.

Here, I have not used chroot /mnt/sysimage command.So that I could show you ,how it looks and what happen.So do not get confuse over here.

Step 12: Now we are editing the grub.conf file where we can find the grub password has been set.

Edit the grub.conf file

vi /mnt/sysimage/boot/grub.conf

Run the below command as given in screenshot.

linux rescue grub password

Search the line have written something,password --md5 some-encrypted-password. Comment or remove this line from grub.conf file.

See in our screenshot,I have commented the line.

recover grub password

Step 13: After saving the file ,now reboot the system,run the command.

exit

Step 14: If you have not run the command chroot /mnt/sysimage before editing the grub.conf. You will be back to given below screen.If yes,now select Reboot and then OK

linux rescue grub password recovery

REMOVE your installation media at the time of reboot,otherwise it will again go to O.S installation screen

Now on booting of system,you will not see grub password.If yes,practical is completed.

recover linux grub password

Read Some More Articles

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.