歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux教程:Bootloader 的密碼設置

Linux教程:Bootloader 的密碼設置

日期:2017/2/28 15:53:42   编辑:Linux教程
【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 文件

  1. # grub.conf generated by anaconda
  2. #
  3. # Note that you do not have to rerun grub after making changes to this file
  4. # NOTICE: You have a /boot partition. This means that
  5. # all kernel and initrd paths are relative to /boot/, eg.
  6. # root (hd0,0)
  7. # kernel /vmlinuz-version ro root=/dev/sda2
  8. # initrd /initrd-version.img
  9. #boot=/dev/sda
  10. default=0
  11. timeout=5
  12. password --md5 $1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
  13. splashimage=(hd0,0)/grub/splash.xpm.gz
  14. hiddenmenu
  15. title Red Hat Enterprise Linux Server (2.6.18-194.el5)
  16. lock
  17. password --md5 $1$iQmBa0$rO6mfPQoEGk7xXFaFDS1y0
  18. root (hd0,0)
  19. kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
  20. initrd /initrd-2.6.18-194.el5.img
Copyright © Linux教程網 All Rights Reserved