Reset root password in CentOS 7 / RHEL 7


Reset root password in CentOS 7
Reset root password in CentOS 7

There may be some occasion you will end up with requirement to reset the root password, the occasion comes when you forget root password; follow this guide to reset the password of root. In CentOS, single user mode will help us to achieve our goal of resetting root password.

Boot your system in to single user mode.

chroot your system

chroot /sysroot

reset the root password.


Update SELinux information.

touch /.autorelabel

Exit chroot


Reboot your system.


Login with new password.

That’s All.

You might also like

  • Robert

    Works well, thanks!

  • Sudheer

    Thanks a lot RaJ 🙂 this helped me

  • Jan K

    Hi , but a hacker can also do this ? on my Linux server.

    • Yes, it is possible if they can access the server console

      • Jan K

        ok thanks for the info , I changed my password on my linux server and make it really strong 🙂