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,如需轉載請自行聯系原作者