First we need to reboot the system.
Secondly from the grub boot loader we need to press e from the keyboard. Here e means edit.
Now go to end of the line number-4 and write rd.break Note: rd = rescue disk
Then press Ctrl+X to load the system
switch_root:/# mount -o remount,rw /sysroot
switch_root:/# chroot /sysroot ==> (Access to the root file system)
Here we need to configure the new password for the root user
sh-4.2# passwd ==> Hit enter
Type new password
Retype new password
Then write down the commands below:
sh-4.2# touch /.autorelabel ==> SELinux Policiy Relabel
sh-4.2# exit
switch_root:/# exit
Note: Here we need to wait for a while like 2/3 minutes.
Finally login to the system using new password.