How to Reset the Root Password of RHEL-7 / systemd




1) Boot your system and wait until the GRUB2 menu appears.
2) In the boot loader menu, highlight any entry and press
e.
3) Find the line beginning with linux. At the end of this line, append the following:


init=/bin/sh

Or if you face a panic, instead of "ro" change to "rw" to sysroot as example below:

rw init=/sysroot/bin/sh

4) 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:


sh-4.2#

5) Load the installed SELinux policy:

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

6) Execute the following command to remount your root partition:


sh4.2# mount -o remount,rw /

7) Reset the root password:


sh4.2# passwd root

9) Reboot the system. From now on, you will be able to log in as the root user using the new password set up during this procedure.


 

Comments