Root Password Recovery

Recovering the Root Password on EL7

Boot your system and wait until the GRUB2 menu appears. On the boot loader menu, use your arrow keys to highlight any entry and press e to edit it. Find the line beginning with linux. At the end of this line, append the following:


Press F10 or Ctrl+X to boot the system using the options you just edited. Once the system boots, you will be presented with a shell prompt without having to enter any user name or password:


Load the installed SELinux policy:

sh-4.2# /usr/sbin/load_policy -i

Remount your root partition so that it is writable:

sh4.2# mount -o remount,rw /

Now reset the root password:

sh4.2# passwd root

When prompted, enter your new root password and confirm by pressing the Enter key. Enter the password for the second time to make sure you typed it correctly and confirm with Enter again. If both passwords match, a message informing you of a successful root password change will appear. You can now reboot the system. When the system comes back up, you will be able to log in as the root user using the new password set up during this procedure.