Centos uses single-user mode to modify Root password

interview questions

How to retrieve the root password, if we accidentally forget the root password, how to retrieve it.
Idea: Enter the single-user mode, and then modify the root password. Because of entering single-user mode, root can log in without a password
.

Implementation steps

1. Turn on the machine -> enter the Enter key when booting -> see an interface and enter e

insert image description here

2. See a new interface, select the second line (edit kernel) and enter e

insert image description here

3. Enter 1 at the end of this line, and then enter the Enter key

![(https://img-blog.csdnimg.cn/cc21d40ef0a44137af517ae2b5615534.png)

4. Enter b again, then you will enter single-user mode

insert image description here

5. At this point, we enter the single-user mode and use the passwd command to modify the root password.

insert image description here
insert image description here

6. Finally, enter reboot to restart

Guess you like

Origin blog.csdn.net/lovoo/article/details/129731284