CentOS6为grub菜单加密码
2018-10-29 本文已影响0人
iWaylee
测试环境:CentOS 6.10
先利用/sbin/grub-md5-crypt产生一个MD5密码串,命令如下:
/sbin/grub-md5-crypt
Password:
Retype password:
$1$kPLT50$M//krL06Sy7FqfatXAzBK/
修改配置文件/etc/grub.conf:
# 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
password --md5 $1$kPLT50$M//krL06Sy7FqfatXAzBK/
#注意:password要添加在splashimage和title之间,否则可能无法生效。
title CentOS 6 (2.6.32-754.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=UUID=2d88b2df-8e52-4201-a70b-e933bfad8ccc rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-754.el6.x86_64.img
下次开机管理grub需要输入密码了
password.png