参考文献连接:ubuntu12.04中设定grub2密码 wlan@ubuntu:~$ grub-mkpasswd-pbkdf2 Enter password: Reenter password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.BA7149A9FD5BEC06DC1E1DF9B2297496F60A118A27A476FAAAE52CA772356A1B0A9DFE6
参考文献连接:ubuntu12.04中设定grub2密码
wlan@ubuntu:~$ grub-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.BA7149A9FD5BEC06DC1E1DF9B2297496F60A118A27A476FAAAE52CA772356A1B0A9DFE688C9AFC1FE0854A9F7EBB73E188E115224FE5D382CAA5762ED85E3BE9.A6B017443B4E0DC0CCA4EE0E0EC5D7C8CC63BA3B71B0D3771FCCD49B5E2DA7D634DF574AA4443AC07C4A1EBCA1D860944C6605CED44B72116143701D6BF257D3
wlan@ubuntu:~$sudo cp /etc/grub.d/00_header /etc/grub.d/00_header.bak
wlan@ubuntu:~$ sudo vi /etc/grub.d/00_header
在文件末尾添加
cat
set superusers="wlan"
password_pbkdf2 wlan grub.pbkdf2.sha512.10000.BA7149A9FD5BEC06DC1E1DF9B2297496F60A118A27A476FAAAE52CA772356A1B0A9DFE688C9AFC1FE0854A9F7EBB73E188E115224FE5D382CAA5762ED85E3BE9.A6B017443B4E0DC0CCA4EE0E0EC5D7C8CC63BA3B71B0D3771FCCD49B5E2DA7D634DF574AA4443AC07C4A1EBCA1D860944C6605CED44B72116143701D6BF257D3
EOF
后保存退出
wlan@ubuntu:~$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-32-generic
Found initrd image: /boot/initrd.img-3.13.0-32-generic
done
重启成功~