重置CentOS 7的Root密码

重置Centos 7 Root密码的方式和Centos 6完全不同。让我来展示一下到底如何操作。

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

重置CentOS 7的Root密码

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

重置CentOS 7的Root密码

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

重置CentOS 7的Root密码

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

重置CentOS 7的Root密码

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

  1. chroot /sysroot

     

6 - 重置密码

  1. passwd root

     

7 - 更新系统信息

  1. touch /.autorelabel

     

8 - 退出chroot

  1. exit

     

9 - 重启你的系统

  1. reboot

     

就是这样!

//linux.cn/article-3962-1.html