1、设置明文密码
[root@ds-education1 ~]# grep -v '^#' /etc/grub.conf
default=0
timeout=5
password 123456  #GRUB启动密码
 
splashp_w_picpath=(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@ds-education1 ~]#
 
2、设置密文密码
[root@ds-education1 ~]# grub-md5-crypt
Password:
Retype password:
$1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
[root@ds-education1 ~]# grub-md5-crypt  //使用md5生成加密密钥
Password:
Retype password:
$1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
[root@ds-education1 ~]# vi /etc/grub.conf
[root@ds-education1 ~]# grep -v '^#' /etc/grub.conf
default=0
timeout=5
password --md5 $1$Qh6pX0$F4erzOSNARZoGvYtErIpx/
#加上—md5的参数表示使用md5加密grub
splashp_w_picpath=(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@ds-education1 ~]#