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


#1
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 https://linuxconfig.org/recover-a-forgotten-root-password-on-redhat-7-linux-selinux-system

#2

sumanla

Hats off to you!


#3

Andrzej Andrzejewski

If you see that root partition is busy while using:

# mount -o remount,rw /

Try:

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

And then again

# mount -o remount,rw /

Worked for me. Thanks for the tutorial !


#4

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


#5

Tariq

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


#6

Amit Sharma

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


#7

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.


#8

Gita Mizzuri -> ato finkelstein

But, somehow it worked for me.


#9

love4lnx

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.


#10

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.


#11

Nicholas Linsky

That worked great! Thank you so much!