Setting GRUB2 Password on Debian Squeeze (6.0.5)

To generate the hashed password run the following and enter the password you want to use:


Example output:


Then edit /etc/grub.d/40_custom and append the following lines to the end of the file.  I am using the user root here in this instance.  It is not the same as the system's root account and you can create multiple accounts if you want with whatever names you wish.  Make sure you replace the entry after root with your own output from the grub-mkpasswd-pbkdf2 command.

set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.AKSDAKSDJ939302502NKJKANVKANVWIEN2034928345092835ADSIFUA09UFN23548098DF0SDFLKSJDRO0395203WELRFISDUF09U45

Once you have saved that run update-grub and reboot your system.  When it gets to the boot menu then you should try to edit the entries and see if it asks for your username and password in order to test the configuration.