【linux】grub加密

时间:2023-03-10 07:05:45
【linux】grub加密

1.计算grub的MD5加密密码:

#grub-md5-crypt

Password: 
Retype password:
输入两遍密码进行确认以后,就会计算出你所输入密码的MD5加密值,如:$1$pFddV1$3X/XnIzEySuSF7fL9BUUj/
复制该密码进行MD5加密后的值。

2.配置grub

[root@server5 ~]# cat /boot/grub/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/sda2
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
password --md5 $1$pFddV1$3X/XnIzEySuSF7fL9BUUj/
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-308.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.18-308.el5.img
3.重启后生效