After Centos is installed on the Virtual Machine and the password is forgotten when the machine is started today, Baidu began to search for the resetting method. After experiment operations, the method is indeed valid. The record is as follows:
(1) Restart Centos. During the startup process, press the "ESC" Key To Go To The gnu grub interface.
(Gnu grub is a multi-operating system startup program from the GNU project. GRUB is the implementation of multi-boot specifications. It allows you to have multiple operating systems in a computer at the same time and select the operating system you want to allow when the computer starts, GRUB can be used to select different kernels on the operating system partition or to pass startup parameters to these kernels)
(2) Select the system to enter and press the "E" Key (edit the command before starting ).
(3) Select the kernel "kernel" of the second operating system and press the "E" Key (edit the selected command in the boot sequence ).
(4) After "rhgb quiet", Enter "1" or "single" and press Enter to save. (Pass the startup parameter to the kernel to enter the single-user mode)
Return to the GRUB interface.
(5) Press "B" to start the system.
(6) Enter "passwd root" in the command line to change the root password and press "Enter.
(7) enter a new password, press enter to save, and then re-enter the password.
(8) If the message "all authentication tokens updated successfully" appears, the password is successfully modified.
(9) enter the "shutdown-r now" command line and restart the system. Then, you can log on to the system using the root account.