# How to recover root password

**URL:** <https://forums.rockylinux.org/t/how-to-recover-root-password/3433>\
**Category:** Rocky Linux Help & Support\
**Created:** [July 7, 2021, 11:17am UTC](https://forums.rockylinux.org/t/how-to-recover-root-password/3433 "2021-07-07T11:17:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [July 7, 2021, 11:27am UTC](https://forums.rockylinux.org/t/how-to-recover-root-password/3433/2 "2021-07-07T11:27:43Z")

</div>

I reset mine perfectly fine with this method:

1. Reboot server, at grub screen press e to edit.
2. Go to end of the linux line and add `rd.break`
3. Do CTRL-X to boot.
4. Do `mount -o remount,rw /sysroot`
5. Do ` chroot /sysroot`
6. Do `passwd root`
7. Do `touch /.autorelabel`
8. Do `exit`

Now reboot, and you should be able to login with the new root password. The command in point 7 is required for selinux, else it won’t work. This will then relabel all files that would have had their selinux permissions reset after the commands we just ran. If selinux is disabled on your system this probably can be omitted, but recommend running it anway.

---

_[View the full topic](https://forums.rockylinux.org/t/how-to-recover-root-password/3433)._
