Here are some steps to password protect recovery mode menu entries in Grub menu in Ubuntu 10.10.
- Install dependancies :
- Add the following the bottom of /etc/grub.d/00_header. Replace myUser with the authorized user name and myPassword with the corresponding password.
cat << EOF
set superusers=”myUser”
password myUser myPassword
EOF - To password protect the Recovery Mode option, edit /etc/grub.d/10_linux :
Replaceprintf “menuentry ‘${title}’ ${CLASS} {\n” “${os}” “${version}”
With
if ${recovery} ; then
printf “menuentry ‘${title}’ –users user1 ${CLASS} {\n” “${os}” “${version}”
else
printf “menuentry ‘${title}’ ${CLASS} {\n” “${os}” “${version}”
fi - Execute sudo grub-mkconfig -o /boot/grub/grub.cfg.
sudo apt-get install grub-common
If you want to encrypt your password in the configuration file, run the command grub-mkpasswd_pbkdf2. It will ask to type your password twice and will return the encrypted value. Replace the password your previously typed in the file /etc/grub.d/00_header with that long value…
References :