(Unlike the previous, when the root password is forgotten and GRUB2 is used as the starter, the root password cannot be reset in single-user mode. The following describes how to reset the root password of CentOS7) 1. start the system and press e to enter the editing mode when GRUB2 starts the screen display. 2. add the following content at the end of the parameter line of linux16/linux/linuxefi:
(Unlike the previous, when the root password is forgotten and GRUB2 is used as the starter, the root password cannot be reset in single-user mode. The following describes how to reset the root password of CentOS7)
1. start the system and press e to enter the editing mode when GRUB2 starts the screen display.
2. add the following content at the end of the parameter line of linux16/linux/linuxefi:
3. press Ctrl + x to start to shell.
4. mount the file system in writable mode:
5. run passwd and change the root password as prompted.
6. if selinux is enabled in the system, you must run the following command. Otherwise, the system cannot be started properly:
7. run the exec/sbin/init command to start the instance normally, or run the exec/sbin/reboot command to restart the instance.