虚机Centos忘记密码如何重置

1进入开机前的页面,选中第一个,按“e”键,进入编辑模式

2找到ro crashkernel项,将ro替换成 rw init=sysroot/bin/sh

3 Ctrl+x
mount -o remount, rw /
chroot /sysroot
chroot /sysroot
passwd root
输入两次密码
touch /.autorelabel

exit

然后用VM重启就好了

你可能感兴趣的:(linux,centos,linux,运维)