Linux教程:Bootloader 的密码设置


【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  

相关内容