Follow the below steps to Protect the GRUB Boot loader with Password :
Step : 1
Open the Terminal and type below command.
It will ask to enter password, So enter the password twice.
Step : 2
After set the password the command will return a encrypted password which we have to set in 40_custom file which is located at /etc/grub.d/ Directory.
So now edit the file and set the encrypted password as shown below :
nano /etc/grub.d/40_custom set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.FECBECE234528AAC47780D5B3C2A24E099DA822F6C9432407EE4A0B66EF5A691774C86E21CB6D9C19CFE96353E34475228286E25A6F12A42758B087F18D5D0F9.6C84C084FA82EEB9E9A239B752F76898C2667FB4FAB8F300A12353E1291DDA3D85F664F1CC546DFC17EB1F47765276078C3EA070F1F3B4EDCAB1F9629644CD81
After set the password update the GRUB file as shown below :
grub2-mkconfig -o /boot/grub2/grub.cfg
Now restart the system and edit the grub by press "e". System will ask for password, Here enter the password you have set on Step : 1