1- 在启动grub菜单,选择编辑选项启动

CentOS7 忘记Root密码解决方法 Linux 第1张CentOS7 忘记Root密码解决方法 Linux 第2张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

2 - 按键盘e键,来进入编辑界面

CentOS7 忘记Root密码解决方法 Linux 第3张CentOS7 忘记Root密码解决方法 Linux 第4张

 

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

CentOS7 忘记Root密码解决方法 Linux 第5张CentOS7 忘记Root密码解决方法 Linux 第6张

 

4 - 现在按下 Control+x ,使用单用户模式启动

CentOS7 忘记Root密码解决方法 Linux 第7张CentOS7 忘记Root密码解决方法 Linux 第8张

5 - 现在,可以使用下面的命令访问系统 chroot /sysroot

6 - 重置密码 passwd root

7 - 更新系统信息 touch /.autorelabel

8 - 退出chroot exit

9 - 重启你的系统 reboot

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄