centos7和centos6修改grub密码的步骤有所不同。
1 先在系统里生成加密的密码:
grub2-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.1367F52B54CF08B325A8AB6185DC12E58AAB5EA32FBCF9FDD694E0884F4AF38FED468A8B388140870F6740E8963AF2853EDDA86AF9591D27125252B006AF9A2D.F8DDC38757049DA9B403E0D56B388C1533755888B93EAC6C98DA9EC42E39D4D7C34EE4ABC6FCA9C5236E6CAC0955AC1D8F24265599761672FE9F3939D52D5671
2 然后找到grub配置文件
cd /boot/grub2/
cp grub.cfg grub.cfg.bak //最好是备份一下
vim grub.cfg //编辑
//在## BEGIN /etc/grub.d/00_header ###下面写入
set superusers="root"
export superusers
password_pbkdf2 root grub.pbkdf2.sha512.10000.1367F52B54CF08B325A8AB6185DC12E58AAB5EA32FBCF9FDD694E0884F4AF38FED468A8B388140870F6740E8963AF2853EDDA86AF9591D27125252B006AF9A2D.F8DDC38757049DA9B403E0D56B388C1533755888B93EAC6C98DA9EC42E39D4D7C34EE4ABC6FCA9C5236E6CAC0955AC1D8F24265599761672FE9F3939D52D5671
编辑回复