Reset root password in CentOS 7 / RHEL 7

ADVERTISEMENT

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.

ADVERTISEMENT
Article will continue after the ad

Boot your system in 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.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

  • 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 🙂

Shares