1.启动系统,在GRUB2启动屏界面时,按下“e”键进入编辑模式
image.png
2.在“UTF-8”之后添加“init=/bin/sh”
image.png
3.按“Ctrl+X”进入到命令行模式
image.png
4.以rw的方式重新挂载“/”,mount -o remount,rw /
image.png
5.passwd命令修改root密码
不用输入以前的密码,需要输入2次新密码
image.png
6.输入 touch / .autorelabel
对文件系统进行relabel 重新标记,若selinux关闭状态,则不用此命令
image.png
7.执行exec /sbin/init 重启系统
image.png