Monday, April 27, 2015

RHEL7- Reset forgot root password

Boot your system and, on the GRUB boot screen, where count begins, press any key and press the e key to edit.
Scroll down with the arrow down key and go to the line where it says "linux16. Go to the end of the line and add the following entry. rd.break selinux=0

--> add " rd.break selinux=0 "  to the end of the linux16 line

Once its added type  ctrl-x  to save and exit.

You will be at the shell prompt. Just type to following commands below to reset the password.

# mount -o remount,rw /sysroot
# chroot /sysroot
# passwd
# exit / exit


Machine reboot's  (selinux = disabled and will be enabled at next reboot) automatically after that.

Note: Run " touch /.autorelabel" command in order to set the SELinux context  ( to update SELinux parameters) of the files to restore properly after reboot.

No comments:

Post a Comment