Reset linux login password

PS:
In daily deployment projects, the operation of forgetting the password is often caused due to many business types. This document records the real and effective operation of changing the login password. The system used this time is centos 7.9. Just the record does not mean that it is applicable to the entire system

For reference only

1. First, restart the system to enter the selection interface (as shown in the figure below)
insert image description here. 2. Press E to edit the selected system.
insert image description here
3. After entering the edit interface, find linux16 and add a string of commands init=/bin/sh at the end of the line, as shown in the figure below
insert image description here

4, Press crtl+x to enter single-user mode
insert image description here

5. Enter the command; mount -o remount,rw /
insert image description here
6, and then type passwd as shown in Figure
insert image description here
7. At this time, you are prompted to enter a new login password of at least 8 digits
insert image description here
. After the reset is complete, type touch / .autorelabel Command
insert image description here
9, enter exec /sbin/init to exit editing and restart
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44200830/article/details/120778159