Elastic Cloud Linux system enters single-user mode via the console to reset SSH login password (applicable to CentOS 8).

Published: 2022-06-10

For centos6 system please refer to: https://www.west.cn/faq/list.asp?unid=756 

For centos7 system please refer to:https://www.west.cn/faq/list.asp?unid=979 


Via Management Center - Business Management - Server Management - Management, as shown in the image:

1.jpg

Then click "System Management" -- "WEB Console", as shown in the image:

2.jpg

Then, as shown in the image, click Hot Restart Server:

console2.png

After clicking, the system will restart. At this time, quickly press the ESC key to enter the kernel interface, select the first one and press the letter e, as shown in the image below:CentOS 8 single-user mode change root password

2: Modify boot permission configuration

CentOS 8 single-user mode change root password

Change ro (read-only) to: rw init=/sysroot/bin/bash 

CentOS 8 single-user mode change root password

3: Press "ctrl+x" to enter emergency mode

CentOS 8 single-user mode change root password

4: Change password

Enter chroot /sysroot/

Then enter passwd to set a new password (it is recommended to set it in plain text)

After the modification is complete, run the command touch /.autorelabel to refresh and take effect.

Example:

chroot /sysroot/

echo 'xxxx' | passwd --stdin root  (xxxx replace with the new password to be changed)

touch /.autorelabel

CentOS 8 single-user mode change root password

5: Exit and restart

exit

reboot

CentOS 8 single-user mode change root password