centos7 忘记root密码

1.在选择内核界面按e,进入编辑界面

2.找到以 linux16 开头的一行,在行尾加上rd.break,然后按Ctrl+X进入紧急救援模式

3.分别输入以下命令,完成更改密码

# mount -o remount,rw /sysroot

# chroot /sysroot

# passwd

# touch /.autorelabel

# exit

# exit

原文地址:https://www.cnblogs.com/1016391912pm/p/14102388.html