To reset the root password on a Red Hat Enterprise Linux 7 or CentOS 7 system when it is forgotten, one can edit the GRUB bootloader to boot into single-user mode. This allows remounting the root filesystem as read-write, using the passwd command to change the root password, and then remounting read-only before rebooting the server.