1、设置明文密码
[root@ www ~]# grep -v '^#' /etc/grub.conf
default=0
timeout=5
password 123456 #GRUB启动密码
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-194.el5)
root (hd0,0)
password 123456 #启动操作系统密码
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-194.el5.img
[root@ www ~]#
2、设置密文密码
[root@ www ~]# grub-md5-crypt
Password:
Retype password:
$1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
[root@ www ~]# grub-md5-crypt //使用md5生成加密密钥
Password:
Retype password:
$1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
[root@ www ~]# vi /etc/grub.conf
[root@ www ~]# grep -v '^#' /etc/grub.conf
default=0
timeout=5
password --md5 $1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
#加上—md5的参数表示使用md5加密grub
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-194.el5)
root (hd0,0)
password 123456
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-194.el5.img