Centos7 forget the root password solution

1. Restart and press esc
Insert picture description here
2. Press e
Insert picture description here
3. Edit and modify two places: ro to rw, add init=/bin/sh after LANG=en_US.UFT-8
Insert picture description here
4. Press Ctrl+X to restart, and change the password
Insert picture description here

5. Because selinux is turned on, you need to execute the following commands to update the system information, otherwise the password will not take effect after restarting

touch /.autorelabel

6. Restart the system

exec /sbin/init

Guess you like

Origin blog.csdn.net/weixin_46152207/article/details/113182675