How To Reset Forgotten Root Password on RedHat 7 / CentOS 7

RedHat 7 / CentOS 7 unlike previous version 6, doesn’t provide the ability to reset / recover root password in signle-user mode any more. This situation takes place, because RedHat 7 / CentOS 7 uses systemd manager instead of sysVinit / upstart and both systemd targets: and require root password. That’s why in RedHat 7 / CentOS 7 we need installation disk to boot from.

Steps to reset root password in RedHat 7 / CentOS 7:

1. Insert RedHat 7 / CentOS 7 installation media into your CD/DVD-ROM

2. Start the system, during BIOS startup launch Boot Menu and choose to boot from CD/DVD-ROM


3. Choose Troubleshooting from the menu

CentOS 7 installation CD menu

4. From the next menu choose Rescue a CentOS system or Rescue a Red Hat Enterprise Linux System


5. In the Rescue window choose Continue

CentOS installation media rescue window

CentOS chroot /mnt/sysimage

CentOS chroot to sysimage

6. In the shell prompt switch to your hard disk filesystem mounted under /mnt/sysimage

Execute command:

sh-4.2# chroot /mnt/sysimage

7. Change root password

Execute command:

sh-4.2# passwd root
Changing password for user root.
New password: **********
Retype new password: **********
passwd: all authentication tokens updated successfully.

8. Exit from chroot mode, reboot and remove RedHat 7 / CentOS 7 instalation media from CD/DVD-ROM, so that OS could boot from hard disk

Execute commands:

sh-4.2# exit
sh-4.2# reboot
Liked it? Take a second to support on Patreon!

Waterprook 4K action Camera

Leave a Reply

Name *
Email *