The root password is modified as follows:
Step 1: press the “e” key when the following interface appears
Step 2: after pressing the “e” key in step 1, the following interface will appear. Press the ↓ key all the way to the bottom to find “lang = zh”_ CN.UTF -8 “, add” init = / bin / sh “after this sentence, and then press Ctrl + X to enter single user.
Step 3: mount the file system in writable mode: Mount – o remount, RW/
Note: as for why we need this command, it is because our / file system is in read-only mode and cannot be modified by default after entering single user mode. At this time, we need to use a command: Mount – o remount, RW / to make our / path file system in read-only mode, so that we can modify it freely.
Step 4: execute the passwd command and modify the root password. The password should be entered twice and the two passwords should be consistent.
Step 5: if the system has enabled SELinux before, you must execute the following command, otherwise you will not be able to start the system normally: touch /. Autorelabel. Then execute the command exec / SBIN / init to start normally, or use the command exec / SBIN / reboot to restart.