8.实验:CentOS7在gurb上加密码

117 阅读1分钟

8.实验:CentOS7在gurb上加密码

[root@centos7 ~]$ grub2-setpassword 	#生成一个grub口令
Enter password: 						#输入密码、如“123.com”
Confirm password: 						#再次密码、如“123.com”
[root@centos7 ~]$ ls /boot/grub2/		#生成一个 user.cfg
device.map  fonts  grub.cfg  grubenv  i386-pc  locale  user.cfg
[root@centos7 ~]$ reboot				#重启

```csharp
按"e"键进入编辑模式

在这里插入图片描述

Enter username:
root		#输入用户名
Enter password:
123.com		#输入密码

完成

清空grub密码

#如果密码忘了、可以把/boot/grub2/user.cfg文件删掉
[root@centos7 ~]#cat /dev/null > /boot/grub2/user.cfg	#清空grub密码
或者
[root@centos7 ~]#rm -f /boot/grub2/user.cfg				#删除文件