Reset root password in CentOS 7 / RHEL 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.

passwd

Update SELinux information.

touch /.autorelabel

Exit chroot

exit

Reboot your system.

reboot

Login with new password.

That’s All.

centos 7passwordresetrhel 7root
Comments (5)
Add Comment
  • 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.

    • ITzGeek Web

      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 🙂