【linux】亲测成功_CentOS7.2/rhel7.2 忘记root密码及重置root密码的方法?

  CentOS 7 root密码的重置方式和CentOS 6完全不一样,以进入单用户模式修改root密码为例。
 

》》》本文档已在CentOS 7.2/rhel7.2 rhel7.0 内核版本 3.10.0 系统中测试成功;

在VMwareWorkstation和真实物理机汇总已经试验过;

第一个里程碑 --在启动GRUB菜单中选择编辑选项,按键 "e" 进入编辑;

第二个里程碑 -- 大约在第16行找到 "ro" 将 "ro" 修改为 " rw init=/sysroot/bin/bash ";

第三个里程碑 -- 同时按下 " ctrl + x ",进入单用户模式;

第四个里程碑 -- 用 "chroot /sysroot " 命令进入系统;

第五个里程碑 -- " passwd root " 重置root密码;

第六个里程碑 -- 用 " touch /.autorelabel " 更新SELinux信息;

第七个里程碑 -- 输入 " exit "退出 chroot ;

第八个里程碑 -- 用 " reboot -f " 重启你的系统;

第九个里程碑 -- 登陆系统测试;

完美重置root密码!
The end!

猜你喜欢

转载自www.cnblogs.com/520ZXL/p/9846943.html