In our study of Linux, cracking root passwords may not be the most commonly used skill, but if you need to crack it, it may be too late to learn. As a result, the first item in the Red Hat certification exam is the cracking of the Root password. Therefore, the following will provide a solution suitable for the CentOS 7/Redhat 7 system to crack the Root password.
Applicable system: CentOS 7 or Redhat 7 operating system
Other versions or other Linux operating systems may not be suitable for this method, please try with caution and do not use it in a production environment at will
Find the "Linux16......" line on the kernel startup page, adjust the cursor to the end of this paragraph**, delete from back to front ** to the next space after ro, and set "ro "After changing to "rw", leave a space and enter "rd.break"
Note: rw followed by a space is not /, here it is displayed as / due to line change, and after the space, enter rd.break (for details, please see the red font in the figure below)
Run the following commands in sequence (as shown below)
chroot sysroot
echo 000000| passwd --stdin root //Set password (here set to 000000)
touch /.autorelabel
exit
exit //The system will start after the second exit
Wait for the system to restart and use the newly set root password to log in to the system