Is there a way I can password protect grub menu entry- e.g. if I dual boot with Windows 7 can I set it so that a password is needed to boot into Win 7?

Secondly I would also like to protect grub menu entries being changed if possible.



There is a Wiki page on Ubuntu covering all type of password related topics.

Basically, edit your configuration

gksu gedit /etc/grub.d/00_header /etc/grub.d/30_os-prober

Add this at the bottom of 00_header:

cat << EOF
set superusers="user1" 
password user1 password1

That way the edits will be password protected, with that user and password.

Now, let's protect the Windows entry. Open 30_os-prober and find this line:

menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \

On that line, add --users, so it ends like this:

menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os --users \

Be careful on not removing the ending slash \.

Save and close, and then run this on a terminal:

sudo update-grub

You can also encrypt your password with grub-mkpasswd-pbkdf2. Please take a look at the wiki for more details.

  • I have the line menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os { in that file, is this the same? I can't see any other mention of windows in the 30_os-prober file. – fpghost Jan 28 '13 at 20:20
  • Yes, I'm on 12.10, so that's the reason of the difference. – Jorge Suárez de Lis Jan 28 '13 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.