How to set the Grub2 password in Ubuntu

  

Grub is a bootloader from the Gnu project. It is a multi-boot specification implementation that allows users to have multiple operating systems in the computer at the same time and select when the computer starts. The operating system you want to run. In the Ubuntu system, many users will set a password for Grub2, but how do you do this? The following small series will introduce you to the method of setting the Grub2 password in Ubuntu.

steps:

leekwen @ leekwen: ~ # grub-mkpasswd-pbkdf2

Enter password: "" "Here you enter the password for grub

Reenter password: "" Enter your grub password here

Your PBKDF2 is grub.pbkdf2.sha512.10000.BC4D0A450E86EE447561FC822C832xxxxxxxxxxxxx45572D3B4E40500CE

leekwen@leekwen:~# cp /etc/grub .d/00_header /etc/grub.d/00_header.bak

leekwen@leekwen:~# vi /etc/grub.d/00_header

leekwen@leekwen:~# tail -n 6 /etc/grub.d/00_header

### Add those line to set GRUB2 password

cat "EOF

set superusers=“leekwen”

password_pbkdf2 leekwen grub.pbkdf2.sha512.10000.BC4D0A450E86EE447561FC822C832xxxxxxxxxxxxx45572D3B4E40500CE

EOF

### Add end

leekwen@leekwen:/etc/grub.d# update -grub "Run this command to take effect

Generating grub.cfg . . .

Found linux image: /boot/vmlinuz-3.11.0-15-generic

Found initrd image: /boot/initrd.img-3.11.0-15-generic

Found memtest86+ image: /memtest86+.bin

done

After restarting, when you start the item, press e, you will be asked to enter:

username:

password:

Only the username (such as the username I just set: leekwen) and the password (just the password generated by grub-mkpasswd-pbkdf2) can be used to start. The item's edit menu, the start item is safe. Remember, you must run the “update-grub” command after modifying 00_header to be effective!

The above is the way to set the Grub2 password in Ubuntu. If you don't know the user, you can refer to the steps described above to set the password. Users who need it can try it out!

Copyright © Windows knowledge All Rights Reserved