Resetting the root password on RHEL 8 shows a procedure to reset the root password.
As a system administrator, it’s essential to store all the system’s passwords securely. However, what do you do if you lose the root password for a specific system? What do you do if you do not have a non-root user with sudo permissions? This is the worst situation, and you, as a system administrator, must be prepared to handle it.
We will show a procedure to reset the root password by booting the system into the special mode. In this mode, the boot process stops before the system hands over control from the initramfs to the actual system.
Procedure
1- Reboot the system and, on the GRUB boot screen, press the e key to interrupt the boot process:

2- Set the cursor to the end of the line that starts with linux:

3- Append rd.break
to the end of the line that starts with linux
:

4- Press Ctrl+x to start the system with the changed parameters. The switch_root
prompt appears:

5- By default, the file system is mounted as read-only in the /sysroot
directory. Remounting the file system as writable allows you to change the password:
mount -o remount,rw /sysroot

6- Enter the chroot
environment:
chroot /sysroot

7- Reset the root
password:
passwd

8- Enable the SELinux relabeling process on the next system boot:
touch /.autorelabel

9- Exit the chroot
environment:
exit
10- Exit the switch_root
prompt, to reboot the system:
exit

Note: Wait until the SELinux relabeling process is finished. Note that relabeling a large disk can take a considerable amount of time. The system reboots automatically when the process is complete
Verification
Log in as the root
user by using the new root password:

That’s it 🙂