grub & grub2
#####################################################
grub(grub-0.9x)
#####################################################
/boot/grub/grub.conf
default 0
timeout 5
hiddenmenu
password=123456
color cyan/blue white/blue
title "Ubuntu12.04 LTS"
lock
root (hd0,0)
kernel /boot/vmlinuz-3.2.0-23-generic ro root=/dev/hda1 text
initrd
/boot/initrd.img-3.2.0-23-generic
MD5加密
grub-md5-crypt
password:
Retype password:
$!x2klaflasjdfljaakldjfde8
将password=123456替换为
password --md5 $!x2klaflasjdfljaakldjfde8
阻止用户更改grub
...
timeout 5
password --md5
$!x2klaflasjdfljaakldjfde8
title ...
注:但用户仍可通过按‘e’来编辑启动项
单独锁定某个启动项
...
timeout 5
title Ubuntu12.04 LTS
password --md5 $!x2klaflasjdfljaakldjfde8
root (hd0,0)
交互和启动都锁定
...
timeout 5
password --md5 $!x2klaflasjdfljaakldjfde8
title Ubuntu12.04 LTS
lock
root (hd0,0)
kernel /boot/vmlinuz-3.2...
initrd /boot/initrd-3.2...
title CentOS6
lock
root (hd0,1)
kernel /boot/vmlinuz-2.6...
initrd /boot/initrd-2.6...
要使用不同的lock可以
...
timeout 5
password --md5 $!x2klaflasjdfljaakldjfde8
title Ubuntu12.04 LTS
lock
root (hd0,0)
kernel /boot/vmlinuz-3.2...
initrd /boot/initrd-3.2...
title CentOS6
password --md5
$!12koaflasjdxljaakykjfdel
root (hd0,1)
kernel /boot/vmlinuz-2.6...
initrd /boot/initrd-2.6...
title BackTack 5
password --md5
l!#2kkaflasjd*ljaakykjfle!a
root (hd0,3)
kernel /boot/vmlinuz-2.6...
initrd /boot/initrd-2.6...
修复grub
通过livecd启动
sudo grub
grub>root
(hd0,0)
grub>setup (hd0)
grub>quit
#####################################################
grub2(grub-1.9x)
#####################################################
/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using
templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
fi
function savedefault {
}
function recordfail {
}
function load_video {
}
if [ "${recordfail}" = 1 ]; then
else
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=yellow/black
set menu_color_highlight=red/light-gray
if background_color 75,75,75; then
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
}
if [ ${recordfail} != 1 ]; then
else
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu,Linux 3.2.0-23-generic' --class ubuntu --class
gnu-linux --class gnu --class os {
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows
--class os {
}
menuentry "Windows 8 (loader) (on /dev/sda2)" --class windows
--class os {
}
menuentry "CentOS (2.6.32-279.el6.x86_64) (on
/dev/mapper/vg0-root)" --class gnu-linux --class gnu --class os
{
}
menuentry "Ubuntu,Linux 3.2.0-23-generic (on
/dev/mapper/vg1-ubuntu)" --class gnu-linux --class gnu --class os
{
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu
entries.
# menu entries you want to add after this
comment.
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f
fi
### END /etc/grub.d/41_custom ###
最显著的变化
color cyan/blue white/blue
title
root (hd0,0)
kernel