Sometimes you need to reset root password from a Centos 7 system.
Here I will show an easy way, not the only one.
First you’ll need access to grub boot screen, if system it’s running you can send an Ctrl+Alt+Supr key combination
at this point we can press the key e to edit boot sequence
we need to move down to the line linux16
we should append rd.break at the end of line
and press Ctrl+X to boot with line modifications.
If we edit all correctly we will have a shell in emergency mode
in rescue mode mount point / can be accessed under /sysroot directory, but it’s on readonly, we need to remount with write permissions.
mount -o remount,rw /sysroot
afther this we will do a chroot in this dir to access to all commands
now we can change root password executing
finally we need to force our system to relabel selinux file context because in emergency mode selinux it’s not enabled
finally we need to exit from chroot
and reboot our system to make a normal boot
now you should have root access using edited password