Why do we do this? The packages all know how to directly perform the following operations:
Leekwen @ leekwen :~ # Grub-mkpasswd-pbkdf2Enter password: <enter Your grub password Reenter password here: <enter Your grub password here Your PBKDF2 is grub. pbkdf2.sha512.10000. keystore @ leekwen :~ # Cp/etc/grub. d/00_header/etc/grub. d/00_header.bakleekwen @ leekwen :~ # Vi/etc/grub. d/00_headerleekwen @ leekwen :~ # Tail-n 6/etc/grub. d/00_header ### Add those line to set GRUB2 password cat <EOFset superusers = "leekwen" password_pbkdf2 leekwen grub. pbkdf2.sha512.10000. bc4d0a424e86ee447561fc822c832xxxxxxxxxxxxx45572d3b4e40500ceeof ### Add endleekwen @ leekwen:/etc/grub. d # update-grub <run this command to Generating grub. cfg... found linux image:/boot/vmlinuz-3.11.0-15-genericFound initrd image:/boot/initrd. the img-3.11.0-15-genericFound memtest86 + image:/memtest86 +. bindone
In this way, after the restart, when you press e for the startup Item, you will be asked to enter:
username:password:
Only after the user name (for example, the user name I just set is: leekwen) and the password is correct (the password just generated with the grub-mkpasswd-pbkdf2) can enter the edit menu of the startup Item, this step is safe. Remember to run the "update-grub" command after modifying the 00_header so that it will take effect !!!