CentOS linux7 重置root密码

1、启动linux,进入grub,就是选择系统界面,选中系统按e进入编辑界面

2、找到linux16那一行,在末尾加上init=/bin/sh、按Ctrl+x,使用单用户模式启动
4、mount -o remount,rw /
5、重置密码passwd root
6、touch /.autorelabel
7、运行命令exec /sbin/init 启动系统

原文地址:https://www.cnblogs.com/xianhaiyan/p/7649103.html