计算机网络/计算机科学与应用/系统/运维/开发

CentOS忘记登录密码解决方案

1、在grub启动菜单

image.png

2、按‘e’键进入编辑模式

image.png

3、在‘linux16’行修改ro为rw init=/sysroot/bin/sh

image.png

4、按‘Ctrl+x’进入单用户模式

image.png

5、使用chroot进入系统

chroot  /sysroot


6、重置密码

passwd  root


7、更新selinux信息

touch  /.autorelabel


8、退出chroot

exit 或  exec  /sbin/init


9、重启系统

reboot


重新使用新的登录密码登录即可!

天天晨练不仅为了健身,也为了体现生命的倔强

评论

^