【1】 防止進入GRUB 控制台
1】生成密碼hash
/sbin/grub-md5-crypt
Password: kakane
Retype password: kakane
$1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
2】編輯/etc/grub.conf 文件 在timeout行下添加
password --md5 $1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
如此系統引導時,如果不首先按[p] 和 GRUB 口令 ,GRUB菜單就不會允許進入編輯器或命令界面.
【2】 為操作系統加鎖
編輯/etc/grub.conf 文件 在title 行下加入
title Red Hat Enterprise Linux Server (2.6.18-194.el5)
lock
password --md5 $1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
【3】 如此不知道密碼的用戶既不能進入單用戶模式 也不能進入系統,再為BIOS設置密碼
使用戶不能用其它方式引導
【4】 完整/etc/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$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
- splashimage=(hd0,0)/grub/splash.xpm.gz
- hiddenmenu
- title Red Hat Enterprise Linux Server (2.6.18-194.el5)
- lock
- password --md5 $1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
- root (hd0,0)
- kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
- initrd /initrd-2.6.18-194.el5.img