centos7 root password retrieval

1. Restart the system

2. Select the system, do not press Enter, press the letter e

3. Next, enter the editing interface, use the up and down keys on the keyboard to move the cursor down, find the "number of lines starting with "Linux16"", and enter: init=/bin/sh at the end of the line. As shown in the picture:

4. After the input is complete, directly press the shortcut key: Ctrl+x to enter the single-user mode. As shown in the picture:

5. Input: mount -o remount,rw / in the position where the cursor is blinking (the position of the last line) (note: there is a space between mount and -o and between rw and /, which cannot be omitted), and press The keyboard's Enter key. As shown in the picture:

6. Next, enter: passwd at the end of the new line, and press the Enter key on the keyboard after completion. In the pop-up content is the operation of modifying the password. Enter the new password at the position where the cursor is blinking (the password is not displayed when entering, as if there is no response, just remember that the password you entered is correct) It’s ok, the password must be no less than 8 characters, otherwise the modification will fail), press the Enter key (Enter) on the keyboard after completion. As shown in the picture:

7. Next, enter the password you just entered and set again.

 

8. Enter: touch /.autorelabel (note: there is a space after touch and /) in the position where the mouse is blinking (in the last line), and press the Enter key (Enter) on the keyboard after completion.

9. Continue to enter: exec /sbin/init at the position where the cursor is blinking (note: there is a space after exec and /), press the Enter key (Enter) on the keyboard after completion, and it will start automatically after completion.

 

Guess you like

Origin blog.csdn.net/sweetsoft/article/details/115511966