天天看点

给GRUB中的菜单加入密码。

linux中,管理GRUB的配置文件是/boot/grub/grub.conf,用VI编辑器打开grub.conf显示如下:

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub xxxxxxxxxxxx

# NOTICE: You have a /boot partition.xxxxxxxxxxxxxxxxxxxxx

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# boot=/dev/sda1

default=0                   //默认进入的菜单(进入的菜单以下面的title为顺序,0表示第一个title的菜单)

timeout=10               //进入默认菜单的超时时间

splashimage=(hd0,0)/grub/splash.xpm.gz            //引导界面的背景图片路径

title red hat linux                                                   //标题菜单(和上面的default=0对应)

      root (hd0,0)          //0表示为第一个分区,此行是标出boot分区所在分区号。0为第一个分区

      kernel /vmlinuz-2.4.20-8 ro root=LABEL=/     //内核加载的位置

      initrd /initrd-2.4.20-8.img                                //虚拟盘镜像的位置。

如果要给第一个标题菜单进入时加上密码,在title red hat linux下插入一行:

title red hat linux

      password 12345              //插入此行,即可给linux菜单加入密码。

      root (hd0,0) 

如果要把密码以MD5进行加密,不让它以明文显示,可以插入命令:

      password --md5 "MD5密文"     //插入此行,MD5密文获取方式见()中内容

      root (hd0,0)

(MD5密文获取方式:使用grub-md5-crypt命令,然后输入两次需要设置的密码,即可算出密文)

对全局启动项进行加密,在title red hat linux上面插入一行:

xxxxxxxx.......

splashimage=(hd0,0)/grub/splash.xpm.gz 

password 12345            //在此插入一行

        lock                   //加入此行,表示受到密码限制,不加则不受之前设置的密码限制。

        root (hd0,0) 

        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/   

        initrd /initrd-2.4.20-8.img

本文转自 qq8658868 51CTO博客,原文链接:http://blog.51cto.com/hujizhou/1290912,如需转载请自行联系原作者

继续阅读