Reset root password on CentOS

In the GRUB menu, select the kernel to edit and press e.

Go to the line starting with linux16 and add rd.break. You can remove rhgb quiet to see the boot process. Press Ctrl+x to boot in single user mode.

To access the system type mount -o remount,rw /sysroot and chroot /sysroot to treat sysroot as root directory.

Use passwd to change root password or pam_tally2 to unlock the account.

touch /.autorelabel to tell SELinux to do a restoreconf on next boot.

Exit and reboot.