centos single-user mode, no need to log in to change root password

Enter single user mode

在选择内核的时候,摁e【机器开启后,注意观察下方提示信息,会有显示'e'字母的时候摁下】
则会进入以下界面

Insert image description here

找到ro 修改为rw 并打空格后添加init=/sysroot/bin/sh
再按Ctrl+x,就可进入单用户模式

Switch system

After entering single-user mode, enter the following command to switch to the normal system so that you can use the command to change the password:

chroot /sysroot

change Password

Enter the following command twice to be prompted for a new password and then confirm the password:

passwd root

Insert image description here

Exit system

exit

Restart the system

reboot
#重启后,即可使用新密码登录

After entering single user, all instructions are summarized

Insert image description here

Guess you like

Origin blog.csdn.net/m0_50760467/article/details/131934358