Recover a forgotten root password on Redhat 7 Linux Selinux system -

The way on how you can reset a forgotten root password on a Linux system have not changed for many years. Resetting a root password on RHEL7 Linux system have not change much except that now we deal with SElinux and the system is now using systemd instead of init.
This is a companion discussion topic for the original entry at


Hats off to you!

Andrzej Andrzejewski

If you see that root partition is busy while using:

# mount -o remount,rw /


# umount -f /dev/mapper/rhel-root

And then again

# mount -o remount,rw /

Worked for me. Thanks for the tutorial !

subham Singh -> Andrzej Andrzejewski

it’s does not mater mount -O remount,rw /sysroot

ok dude because that was read only mode now will be going read write mode ok


in linux 7.3 Redhat it is asking for login username and password after rebooting, what should i do ?

Amit Sharma

Well done bro, your explanation is in more detail than Red Hat Customer Portal…

ato finkelstein

One little note - if you execute “exec /sbin/init” relabeling is not done , thus you cannot login on your machine
If machines is just rebooted - relabeling is done.

Gita Mizzuri -> ato finkelstein

But, somehow it worked for me.


Thanks for this post. Phew!!! This was perfect for my version of RHEL. After stumbling thru so many posts and trials, this article nailed it.

David Anthony

This does not appear to be working with encrypted \ , \Home and SWAP partitions. After changing the ‘rgbh quiet’ entry to the ‘init=…’ entry in Grub2, I get as far as “enter password for luks=… \Home partition”. After doing so it straight loads to CENTOS 7 GUI? Is there a way to disrupt loading to GUI to process the RW cmds? Thank you in advance.

Nicholas Linsky

That worked great! Thank you so much!

We are running a RHEL 7.5 server and these instructions don’t work. We complete them successfully, but when we try to log in we get access denied. We have also tried adding rd.break to the end of the boot line, performing a mount -o remount,rw /sysroot, chroot /sysroot and resetting the password that way followed by a touch /.autorelable with no luck.