HOW TO SET/CHANGE GRUB BOOT LOADER PASSWORD IN REDHAT/CENTOS/FEDORA
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 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 password.
In this artical we are going to discuss on how to Set/Change the GRUB Boot loader password in Linux.
Follow the below Steps to Change GRUB Boot Loader Password :
Step: 1 Generate GRUB Password
Reset the GRUB password by below command.
$ grub-md5-crypt # To Generate MD5 hash password
After 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 given a MD5 hash password which we need to paste in main configuration file of GRUB.
“/boot/grub/grub.conf” is the main configuration file of GRUB OR we can access the same file in 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 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.
Also Read :
HOW TO RESET FORGOTTEN ROOT PASSWORD IN RHEL/CENTOS 7
HOW TO RESET FORGOTTEN LINUX ROOT PASSWORD ON REDHAT/CENTOS 4/5/6
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 enter “p” It will ask for password which we reset now as shown below.
So this is how we can Set/Change the GRUB Boot Loader Password in Linux.
If you found this article Useful then Like It, Share It or Subscribe us For Updated Linux Guides and Tutorials. If you have some thing to say then feel free to Comment on the Comment box below.
when i try to run the command 'grub-md5-crypt', terminal shows this error
[root@localhost ~]# grub-md5-crypt
bash: grub-md5-crypt: command not found…
so is there any package require to install before running this?
This article is for RHEL/CentOS Version 5/6 or before version's.
Which version of linux are you using?