1

So I am trying to set password for grub to prevent entry of single-user mode who might have direct physical access to my machine. I am working on RHEL7, and the redhat portals show that this feature was added in RHEL7.2

I ran following command:

grub2-mkpasswd-pdkbf2

which prompted me to enter the password. After I entered the password I got hash code which I copied.

Now I need to know in which configuration file do I need to paste that hash code? Should it be /etc/grub.d/40_customs?

But what entries should I make in this file?

1 Answer 1

0
  1. Edit /boot/grub2/grub.cfg
  2. Locate the boot entry that you want to protect with password by searching for lines beginning with menuentry
  3. Remove the --unrestricted parameter from the menu entry block
  4. Save and close grub.cfg

Now even booting the entry requires entering the root username and password.

Source: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-Protecting_GRUB_2_with_a_Password.html

1
  • 1
    There are important notes in the original source about grub.cfg being a generated file.
    – VPfB
    Commented Apr 4, 2017 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .