Centos7 Root password reset

There are issues with selinux contexts if you just reset with any of the old fashion methods.

Procedure 25.5. Resetting the Root Password Using an Installation Disk

  1. Start the system and when BIOS information is displayed, select the option for a boot menu and select to boot from the installation disk.
  2. Choose Troubleshooting.
  3. Choose Rescue a Red Hat Enterprise Linux System.
  4. Choose Continue which is the default option. At this point you will be promoted for a passphrase if an encrypted file system is found.
  5. Press OK to acknowledge the information displayed until the shell prompt appears.
  6. Change the file system root as follows:
    sh-4.2# chroot /mnt/sysimage
  1. Enter the passwd command and follow the instructions displayed on the command line to change the root password.
  2. Remove the autorelable file to prevent a time consuming SELinux relabel of the disk:
    sh-4.2# rm -f /.autorelabel
  1. Enter the exit command to exit the chroot environment.
  2. Enter the exit command again to resume the initialization and finish the system boot.

I had issues with pam.d using "uid >=1000" as well, and then securetyy. I commented out the >=1000 lines from password-ac and system-auth-ac. I added tty1 to /etc/securetty

Back to top