有时,需要出现一个需要设置密码以禁止其他人在没有正确密码的情况下引导系统。
使用Grub作为装载机时,可以轻松完成。
首先启动Linux系统。
ENTER GRUB的命令提示符:
# grub GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub>
然后键入md5crypt命令,该命令将询问密码并吐出其在MD5加密版中的等效版本:
grub> md5crypt Password: Encrypted: $1$A9NHZ/$N.6k9riAFMbV/nfsZ2LnD1
现在取决于Linux发行版找到并编辑GRUB的配置文件。
注意:GRUB的配置文件可以位于各个地方
- /boot/grub/menu.lst.
- /etc/grub.conf.
- /boot/grub/grub.conf.
将MD5加密密码添加到GRUB的全局配置:
timeout 5 color cyan/blue white/blue password --md5 $1$A9NHZ/$N.6k9riAFMbV/nfsZ2LnD1
保存并重新启动。
日期:2020-07-07 20:54:59 来源:oir作者:oir