Have you ever forgot the root password or had any client that didn’t know the root password of it’s Linux server?

This article will tell you how to reset the root password in any Fedora OS family, well… never tried it in Red Hat but I expect it to work the same way as for Fedora and CentOS.

So if you are standing in your terminal window, just CTRL+ALT+DEL … Reboot now … Shutdown -r … Reboot the system using which method you like more.

When you reach the grub menu, press E and search for the line starting with “linux” that maps the paths for vmlinuz root and at the end of that line type

rw init=/bin/bash

(obs: don’t forget to add \ (backslash) if you want to start on a new line or for any reason you need to add a new line. )

Reboot Pressing Ctrl-X

And there you go, after booting you will be in “rescue mode” or for the more conservative ones, init 1 ; runlevel 1.

Now you just need to:

passwd

Type the new password and confirm it and then:

touch / .autorelabel

This step is needed otherwise your new password will not work.

/sbin/reboot -f

You can now use your new root password after system boot up.