Root Password Recovery in RedHat 7

Root Password Recovery in RedHat 7


1) Reboot your system

2) Select the kernel and press the key "e" in order to edit the grub boot file


3) Navigate on the configuration until you can see the line "linux16" and move your cursor at the end of the line to add the word "rd.break"


4) Press Ctrl-X to continue with the boot process

5) Remount the partition sysroot:  # mount –o remount, rw /sysroot

6) Chroot into the partition /sysroot :  # chroot /sysroot

7) Change the password :  # passwd root

8) Relabel the system to avoid any conflicts with SELINUX

9) Exit twice and reboot your server or virtual machine

10) As you can see on the screen you cannot enter the system with the old/lost password