CentOS 7 – Reset root pw with SELinux enabled
I found way too many hits for this process that bounced around depending on whether x or y was set. Here is the quickest method I tested when SELinux is live:
- Boot system and press ‘e’ at grub menu
- Find line that begins with linux16 or linuxefi
- remove rhgb quiet
- append rd.break enforcing=0 to end of that same line
- ctrl + x
- mount -o remount,rw /sysroot
- chroot /sysroot
- passwd
- enter and confirm new pw
- mount -o remount,ro /
- exit (exit from chroot env)
- exit (exit custom boot and continue)
- login as root with new pw
- restorecon -v /etc/shadow
- ls -Z /etc/shadow
- role should now display as shadow instead of unlabeled
- setenforce 1
- reboot now