InformationSetting the boot loader password will require that anyone rebooting the system must enter a password before being able to set command line boot parameters
This recommendation is designed around the grub2 bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace '/boot/grub2/grub.cfg with the appropriate grub configuration file for your environment
The information can be placed in any /etc/grub.d file as long as that file is incorporated into grub.cfg
The superuser/user information and password should not be contained in the /etc/grub.d/00_header file.
A custom file, such as /etc/grub.d/40_custom should be used so it is not overwritten should the Grub package be updated.
Requiring a boot password upon execution of the boot loader will prevent an unauthorized user from entering boot parameters or changing the boot partition. This prevents users from weakening security (e.g. turning off SELinux at boot time).
If password protection is enabled, only the designated superuser can edit a Grub 2 menu item by pressing 'e' or access the GRUB 2 command line by pressing 'c'
If GRUB 2 is set up to boot automatically to a password-protected menu entry the user has no option to back out of the password prompt to select another menu entry. Holding the SHIFT key will not display the menu in this case. The user must enter the correct username and password. If unable, the configuration files will have to be edited via the LiveCD or other means to fix the problem
You can add --unrestricted to the menu entries to allow the system to boot without entering a password. Password will still be required to edit menu items.
Solutioncreate an encrypted password with grub2-mkpasswd-pbkdf2:
Enter password: <password>
Reenter password: <password>
Your PBKDF2 is <encrypted-password>
Add the following into /etc/grub.d/40_custom
password_pbkdf2 <username> <encrypted-password>
Run the following command to update the grub2 configuration:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Category: CONFIGURATION MANAGEMENT, SYSTEM AND SERVICES ACQUISITION
References: 800-53|CM-1, 800-53|CM-2, 800-53|CM-6, 800-53|CM-7, 800-53|CM-7(1), 800-53|CM-9, 800-53|SA-3, 800-53|SA-8, 800-53|SA-10, CSCv7|5.1
Control ID: d21f241d742c28fcc82b83b50e5efa3bb25ceed32478a9c5929e74c74e4b99b0