Security and Application of Centos7 system (3) grub menu restriction
preface
The root password can be modified through grub boot, which is convenient for us. If the password is forgotten, we can modify the password through grub boot, but it also provides convenience for outsiders. Outsiders can enter the system and modify the root password through grub boot, which is a very serious danger. So you need to set a password to restrict the grub menu.
1. backup
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
cp /etc/grub.d/00_header /etc/grub.d/00_header.bak
2. Generate Key
grub2-mkpasswd-pbkdf2
3. modify the configuration file
vim /etc/grub.d/00_header
4. Generate a new grub.cfg configuration file
grub2-mkconfig -o /boot/grub2/grub.cfg
5. verification
restart