Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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