How to change the root password if you forget it in VMware CentOS7

How to change the root password if you forget it in VMware CentOS7

1. When the page comes in, click the up and down keys immediately to stop automatic entry.

(Immediately click the up and down buttons on the incoming page to stop automatic entry)

Insert image description here

2. Press the e key on the keyboard to enter the editing page e

(Click the keyboard e key to enter the editing page)

e

3. Find this line of code linux16/vmlinuz... and enter the code after the last UTF-8

(Find this linux16/vmlinuz … This line of code, enter the code after UTF-8 at the end)
Insert image description here

rw init=/bin/bash

Insert image description here

4. Press ctrl+x to enter the bash terminal

(Press ctrl+x to enter the bash terminal)

ctrl+x

5. Change password using bash command line

(Insert code)

passwd root

Enter the password after New password, regardless of the password length prompt, and proceed to the next step to confirm the password
.

Insert image description here

5. Enter the command

(Insert code)

touch /.autorelabel

Insert image description here

6. Enter the command to exit editing.

(Insert code quit edit mode)

exec /sbin/init

Insert image description here

Password change completed! Success!

Guess you like

Origin blog.csdn.net/agatha_aggie/article/details/133304301