Centos7 密码重置

1、在grub启动页面,按e编辑启动选项

2、找到Linux 16的那一行,将ro改为rw init=/sysroot/bin/sh

3、按下 Control+x ,使用修改后的设置启动,出现命令行

4、输入以下命令

chroot /sysroot   #使用过rescue模式的人都知道这是切换文件系统

passwd root   #修改密码

touch /.autorelabel #更新系统信息

exit                       #回到原来的文件系统

reboot     #重启

重置密码的步骤相对简单,作为留存记录下。

原文地址:https://www.cnblogs.com/otherside/p/5805226.html