Single user cracking root password
method one
1. Restart the system
2. In the kernel interface (as shown above), press "e" to enter the edit mode (as shown below), position the cursor on the line linux16, add: init=/bin/sh at the end of the line, and then press ctrl+x
3. Rehang root in read-write mode
# mount -o remount.rw /
4. Modify root password
5. If selinux is turned on, if not, skip this step
# touch /.autorelabel
6. Exit edit mode and restart
# exec /sbin/init
Finished, and then you can log in with the new root password.
Method Two
1. Restart the system
2. In the kernel interface (as shown above), press "e" to enter the edit mode (as shown below), modify the kernel parameters, and then press ctrl+x
3. Re-hang the root in read-write mode
# mount -o remount.rw /
4. Modify root password
5. If selinux is turned on, if not, skip this step
# touch /.autorelabel
6. Exit edit mode and restart
# exec /sbin/init
Finished, and then you can log in with the new root password.