Centos7/8重置root密码
1.开机启动时,输入"e"
2.
centos7:在以下位置输入"init=/bin/sh"
centos8:在以下位置输入"rd.break"
3.按ctrl+x引导启动
4.
centos7:输入mount -o remount, rw /
挂载,允许读写
centos8:输入mount -o remount,rw /sysroot
重新挂载sysroot并给读写权限
输入chroot /sysroot进入救援模式
5.重置密码,输入"passwd root"
6.重置成功后执行"touch /.autorelabel"
7.
centos7:输入"exec /sbin/init"退出重启即可
centos8:按Ctrl+D,退出救援模式后,输入reboot重启