LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 801|回复: 4

如何为grub设置密码?

[复制链接]
发表于 2005-1-6 10:35:11 | 显示全部楼层 |阅读模式
如何为grub设置密码,使得非法用户不能从grub命令引导系统?

我用的redhat linux,找了man 文档,/usr/share/doc/grub*文档,都没有找到?
是不是grub的这一点特征不重要?
发表于 2005-1-6 11:48:59 | 显示全部楼层
http://www.linuxsir.cn/bbs/showt ... t=grub+%C3%DC%C2%EB


学会搜索可能好一点。。。

加油。。
发表于 2005-1-6 11:54:43 | 显示全部楼层
You may be interested in how to prevent ordinary users from doing



whatever they like, if you share your computer with other people. So



this chapter describes how to improve the security of GRUB.



   如果很不幸,你的计算机是更他人共享的话,你可能会对如何防止其他人在你的GRUB上做一些他们喜欢



的事比较感兴趣.所以这一章节描述了如何提高你的GRUB的安全性.







   One thing which could be a security hole is that the user can do too



many things with GRUB, because GRUB allows to modify its configuration



and run arbitrary commands at run-time. For example, the user can read



even `/etc/passwd' in the command-line interface by the command `cat'



(*note cat:. So it is necessary to disable all the interactive



operations.



   有个可能会导致严重案却漏洞的问题是,用户可以通过GRUB做太多的事情,因为GRUB允许在它运行的



时候修改它的配置和执行几乎说有的命令.比如,用户可以在命令行下通过 `cat'命令读取



`/et/passwd',这是件非常可怕的事情.所以,禁止所有的交互式操作非常重要而且必要.







   Thus, GRUB provides "password" feature, so that only administrators



can start the interactive operations (i.e. editing menu entries and



entering the command-line interface). To use this feature, you need to



run the command `password' in your configuration file (*note



password:, like this:



   因此,GRUB提供了 "密码" 功能,这样一来,就只有管理员才可以进交互式操作(也就是编辑引导相



和进入命令行界面).要使用这个特性,你得在配置文件中加入命令 `password'


(*note password::







     password --md5 PASSWORD







   If this is specified, GRUB disallows any interactive control, until



you press the key <p> and enter a correct password.  The option `--md5'



tells GRUB that `PASSWORD' is in MD5 format.  If it is omitted, GRUB



assumes the `PASSWORD' is in clear text.



   如果你做了以上操作,GRUB会关闭所有的交互式操作,除非你按下 <p> 键并输入正确的密码.选项



`--md5'告诉GRUB密码为通过 MD5加密的格式.如果不直指定该选项,GRUB会以明文形式保存密码.







   You can encrypt your password with the command `md5crypt' (*note



md5crypt:. For example, run the grub shell (*note Invoking the grub



shell:, and enter your password:



   你可以使用命令 `md5crypt' (*note md5crypt:来加密密码.例如,运行GRUB的shell



(*note Invoking the grub shell:,然后输入以下命令:







     grub> md5crypt



     Password: **********



     Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb.







   Then, cut and paste the encrypted password to your configuration



file.



   好了,剪切然后复制已加密的密码到你的配置文件.







   Also, you can specify an optional argument to `password'. See this



example:



   同样的,你也可以指定一个可选参数给 `password',如下:







     password PASSWORD /boot/grub/menu-admin.lst







   In this case, GRUB will load `/boot/grub/menu-admin.lst' as a



configuration file when you enter the valid password.



   这样一来,GRUB就会从文件 `/boot/grub/menu-admin'中读取密码了.







   Another thing which may be dangerous is that any user can choose any



menu entry. Usually, this wouldn't be problematic, but you might want to



permit only administrators to run some of your menu entries, such as an



entry for booting an insecure OS like DOS.



   另外一个安全隐患是,任何用户都可以选择引导任意菜单项.通常,这并不会导致什么问题,但可能你会希



望仅仅允许管理员运行某些菜单项,比如引导进入DOS或其他一些缺乏安全性的操作系统.







   GRUB provides the command `lock' (*note lock:. This command always



fails until you enter a valid password, so you can use it, like this:



   为此,GRUB提供了命令 `lock' (*note lock:.这个命令会在你正确的输入密码之后失效.你



可以这样使用它:







     title Boot DOS



     lock



     rootnoverify (hd0,1)



     makeactive



     chainload +1







   You should insert `lock' right after `title', because any user can



execute commands in an entry, until GRUB encounters `lock'.



   你得将 `lock'紧紧跟在 `title'之后,因为除非用户碰到了 `lock'命令,否则他可以执行任何



条目.







   You can also use the command `password' instead of `lock'. In this



case the boot process will ask for the password and stop if it was



entered incorrectly.  Since the `password' takes its own PASSWORD



argument this is useful if you want different passwords for different



entries.



   你也可以用命令 `password'代替 `lock'.这样做的话,引导进程会询问密码,如果输入错误的话



会终止引导.那么它跟 `lock'有什么区别呢?假设你需要为你的不同的引导条目设置不同的密码的话,那



么使用 `password'吧.


想了解详细的grub文档,请看我的签名档
 楼主| 发表于 2005-1-6 17:32:43 | 显示全部楼层
Post by 北南南北
http://www.linuxsir.cn/bbs/showt ... t=grub+%C3%DC%C2%EB


学会搜索可能好一点。。。

加油。。


多谢,在你给出的帖子中找到了我想要的问题!
搜索中找到了北南兄2002年发的一个帖子,文中提到自己grub丢失了之后就是重装!这样的事情我也做过好几次了!!

当然是在搜索中没有找到才发问
而且在man文档和/usr/share/doc/grub*中也没有找到相关内容!
man grub.confi没有找到
info grub.conf也没有找到
到baidu.com中搜索也没有找到自己的信息
呵呵,也是找了好多地方
 楼主| 发表于 2005-1-6 17:33:53 | 显示全部楼层
经典,找到了我想要的东西了!

不过请问:
为什么写一段英文,然后又是一段自己的翻译??
我喜欢这样的文档,我想提高自己英语水平.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表