As incredible as it sounds there are times where we forget our root password, or in the case that we are in a new Linux administration position and the last admin did not document the root credentials for all of his CentOS/RHEL 7 Server.



This task could be considered impossible LOL, it won’t be anymore when you have learned how to reset it with this guide, keep in mind that this procedure will make us reboot the server in order to get to the boot menu, so you better do this in a scheduled maintenance window.

Let’s get started,

First of all, reboot or power on your server (if powered off),

At the boot menu, press e to edit the existing kernel


Scroll down a little bit until you get to the ro underlined option, will be changing it to rw, next to it add init=/sysroot/bin/sh in order to start into a shell.

The newly added options will look like this:




Save and exit by pressing Ctrl + x

Our system will be in emergency mode, this is where We’ll proceed with the root’s password reset, type

And finally, you can go now and use passwd command in order to proceed with changing root’s password.

Before you get too excited, you need to update SELinux Parameters by typing the following command touch /.autorelabel

You just need to reboot your server and login as root. type exit and then init 6 to reboot the server

That’s it, very easy right?, You should be able to sign on and use the system with the new password you created,

As I am doing right now