How to Set/Change Grub Boot Loader Password in Redhat/Centos/Fedora
In this article, we are going to discuss how to Set/Change GRUB Boot loader password in Linux. GRUB stands for [ Grand Unified Boot Loader ] is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation’s Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system’s partitions.GRUB is a very important part of the Linux operating system from where we can perform so many administrative tasks and booting configurations, It is highly recommended that it should be protected by a password.
Follow the below Steps to Change GRUB Boot Loader Password :
Step: 1 Generate GRUB Password
Reset the GRUB password by the below command.
$ grub-md5-crypt # To Generate MD5 hash password
After the above command, it will ask to enter the password which will later on used as a password to unlock the GRUB.
So Enter the Password twice to protect the GRUB.
As we can see that after set the password it has given an MD5 hash password which we need to paste into the main configuration file of GRUB.
“/boot/grub/grub.conf” is the main configuration file of GRUB OR we can access the same file in a different path i.e. “/boot/grub/menu.lst” which is the Symlink or Symbolic Link or Shortcut of the main file i.e. “/boot/grub/grub.conf“.
Step: 2 Generate GRUB Password
Note: it’s highly recommended to do a backup of grub.conf file by using the below command.
$ cd /boot/grub/ $ cp grub.conf grub.conf.backup
Now edit the “grub.conf” file with “vi” command.
$ vi /boot/grub/grub.conf # Edit the GRUB configuration file
Paste the MD5 hash password on “grub.conf” file, For Example:-
password –md5 <MD5 hash Password created created above>
In our case it’s like below shown:-
Note:- (Paste the below line in “grub.conf” file below the hiddenmenu line as shown in Snapshot below)
password –md5 $1$.zE70/$pk4kZhx6Zu9IHz6.4m7Kf0
Now we successfully set the GRUB password, Now its time for Testing.
Step: 3 Edit the GRUB
Reboot the system and press any key before 5 Seconds to interrupt the normal boot process to edit the GRUB entry.
As we can see above System is asking to enter “p” to edit the GRUB to unlock the next set of features.
After entering “p” It will ask for a password which we reset now as shown below.
That’s all, In this article, we have explained How to Set/Change Grub Boot Loader Password in Redhat/Centos/Fedora. I hope you enjoy this article. If you like this article, then just share it. If you have any questions about this article, please comment.