When you forget your root password there is a way to reset root password
first you have to power on a virtual machine or your RedHat Linux machine. When the bootloader menu appears press any key to pause the booting process then select the kernel using the arrow keys
then press letter ‘e ‘ key to go on edit mode
then go to the line that starts linux16 then go along with that line there is keyword ro change that to rw .
And also remove these keywords from that line “console=tty0′ & ‘console=ttyS0,115200n8” Otherwise this prossess will hang
Then come again to the beginning of the linux16 line and press the end key on the keyboard this will move the cursor to the end of that line. At the end add rd.break
Then press ctrl+x for a boot with newly configured settings
Now it will work without hanging
This will boot in to switch_root prompt
switch_root:/# mount -oremount,rw /sysroot
switch_root:/# chroot /sysroot
Now you can change the root password to anything you like.I’m changing my password to sameera
sh-4.2# echo sameera | passwd --stdin root
Then type sh-4.2# touch /.autorelabel
This will relabel all the file systems with SELinux again
Then type exit and again type exit.
Now your RedHat machine is with new root password