- 非明文密码生成
grub-crypt
# 生成sha加密方式的密码
grub-crypt --md5
# 生成md5加密方式的密码
- 配置
将生成的密码粘贴到/etc/grub.conf中,格式如下(password位置):
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
# 此处为加密的密码,--sha和--md5用来说明加密方式
password --sha $6$vRBcWIqOLylJpTex$v80lPovSU/F5C.tpDM5zQbhYJjHGFSlAHhFC.7cEBHiBqA3W/v/HGbasdxFBWNyOdWGQ.3Wzxi4mBgmAOpRes1
title CentOS 6 (2.6.32-573.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-573.el6.x86_64 ro root=UUID=94f2979f-d553-4ffa-ba52-fc2a84e00312 nomodeset rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-573.el6.x86_64.img
时间: 2024-10-12 14:49:46