GRUB md5 加密方法;


jerboa 兄指教,我又读了一下 GRUB 文档,的确感觉到用 md5 加密校验 GRUB 密码比较安全。为了也能让和我一样菜的弟兄,也能知道如何通过 md5 进行 GRUB 密码加密,我不得不把这个教程写出来。哈哈,高手就是免读了,此文为菜鸟弟兄所准备。
md5 加密校码 GRUB 密码,这样会更安全。


1
、用 grub-md5-crypt 成生 GRUB md5 密码;


通过 grub-md5-crypt GRUB 的密码进行加密码运算,比如我们想设置 grub 的密码是 123456 ,所以我们先要用 md5 进行对 123456 这个密码进行加密


[root@linux01 beinan]# /sbin/grub-md5-crypt
Password:
在这里输入 123456
Retype password:
再输入一次 123456
$1$7uDL20$eSB.XRPG2A2Fv8AeH34nZ0

$1$7uDL20$eSB.XRPG2A2Fv8AeH34nZ0
就是通过 grub-md5-crypt 进行加密码后产生的值。这个值我们要记下来,还是有点用。


2
、更改 /etc/grub.conf


比如我原来的 /etc/grub.conf 文件的内容是下面的。


default=1
timeout=10
splashp_w_picpath=(hd0,7)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2061.nptl)
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img
title WindowsXP
rootnoverify (hd0,0)
chainloader +1

所以我要在 /etc/grub.conf 中加入 password --md5 $1$7uDL20$eSB.XRPG2A2Fv8AeH34nZ0 这行,以及 lock ,应该加到哪呢,请看下面的更改实例;


timeout=10
splashp_w_picpath=(hd0,7)/boot/grub/splash.xpm.gz
password --md5 $1$7uDL20$eSB.XRPG2A2Fv8AeH34nZ0
title Fedora Core (2.4.22-1.2061.nptl)
lock
root (hd0,7)
kernel /boot/vmlinuz-2.4.22-1.2061.nptl ro root=LABEL=/
initrd /boot/initrd-2.4.22-1.2061.nptl.img
title WindowsXP
rootnoverify (hd0,0)
chainloader +1

我们仔细看一下,从上面的我们改过的 /etc/grub.conf 中是不是已经用到了我们在第一步通过 /grub-md5-crypt 所产生的密码呢??是不是有点安全感了??