|
Password protect GRUB
Password-protect your boot bootloader so you can get extra security at startup. You also can get the level of physical protection. By GRUB boot to lock to prevent any unauthorized access to protect your server.
First two backup files, so that if there are any errors, you can have the rollback option. Backup '/etc/grub2/grub.cfg' to '/etc/grub2/grub.cfg.old'.
# Cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old
Similarly, the backup '/etc/grub.d/10_linux' to '/etc/grub.d/10_linux.old'.
# Cp /etc/grub.d/10_linux /etc/grub.d/10_linux.old
Open the file '/etc/grub.d/10_linux' and add the following line at the end of the file.
cat << EOF
set superusers = "tecmint"
Password tecmint avi @ 123
EOF
Password protection Grub
Note that in the above document, using your own user name and password instead of "tecmint" and "avi @ 123".
Grub.cfg now generate a new file by running the following command.
# Grub2-mkconfig --output = / boot / grub2 / grub.cfg
Grub generated file
After creating grub.cfg file, restart the machine and hit 'e' to enter editing. You will find that it will ask you to enter the "effective verification" to edit the boot menu.
Boot password-protected menu
After entering the login authentication, you can edit the grub boot menu.
Grub menu file
You can also use an encrypted password in place of the previous step plaintext password. First, the following recommendations to generate an encryption password.
# Grub2-mkpasswd-pbkdf2
[Enter the password twice]
Generates an encrypted password Grub
Open '/etc/grub.d/10_linux' file and add the following line at the end of the file.
cat << EOF
set superusers = "tecmint"
Password_pbkdf2 tecmint
grub.pbkdf2.sha512 ... your encrypted password ...
EOF
Grub password encryption
With the generated password on the system you replace the original password, do not forget to cross-check the password.
Also note that in this case you will need to generate as grub.cfg like the one above. Reboot and hit 'e' into the editor, you will be prompted to enter a user name and password.
We've covered most of the industry's standard distribution RHEL and CentOS 7 7 install the necessary action. If you find we are missing a few points or you have something new to expand the article, you can share with us, we will expand by including your share in this article. |
|
|
|