In the past, the centos7 virtual machine was installed. In order to play with Docker, I forgot the password I set. I reset the password in a circle on the Internet and recorded it.
Only know that you can enter the single user mode by pressing e, but you have to add the corresponding startup when centos7 starts grub2 mode.
1. Step 1 restart the system and press e to enter the edit mode GRUB 2
2. Add
Init =/bin/sh
Selinux = 0
3. Step 3: Remount/root partition, reset root password and autorelable
Use passwd root to change the password
Mount-o remount, rw/
Passwd root
NICE:
NOTE: In case system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error
Now run the below given command for relabeling the SELINUX
If selinux is set to 0, the above error will not occur.
If an error occurs, run the following command:
Touch/. autorelabel
Restart the service.
Exec/sbin/init
OR
Exec/sbin/init
Exec/sbin/reboot