1. Reset the root password (Centos7.6 is used as an example).
1.1 Resetting the Root Password
- How do I reset the root password?
- First, start the system and enter the boot interface. Press”
e
“The editing screen is displayed. As shown in figure:
- Enter the edit screen, use the up and down keys on the keyboard to move the cursor down to the
Linux16
“Number of lines at the beginning of the content”, at the end of the line type:init=/bin/sh
As shown in figure:
- Then, after typing, press the shortcut key directly:
Ctrl+x
The single user mode is displayed. - Next, type in the cursor position:
mount -o remount,rw /
(Note: there are Spaces between each word), then press Enter on the keyboard. As shown in figure:
- Type at the end of the new line:
passwd
Then press Enter on the keyboard. Enter your password and then confirm it again (Tips:The password must contain at least 8 characters, but it is not required. After the password is successfully changed, the password is displayedpasswd.....
“, indicating that the password is successfully changed
- Next, type in the mouse blinking position (in the last line) :
touch / .autorelabel
(note:touch
with/
There is a space behind) and press Enter on the keyboard when finished. - Continue at the blinking position and type:
exec /sbin/init
(note:exec
with/
After that, press Enter on the keyboard and wait for the system to automatically change the password (Tips:After that, the system automatically restarts and the new password takes effect.