If you forget or want to recover the root password of redhat /CentOs machine. You do not need to be panic. It’s possible to break or reset the root password in case if you forget it.

Step 1 :

Reboot your machine, before booting Press ‘e’ to interrupt the booting process of your machine.

Then look for a line linux 16 write  rd.break between initrd16  and Press Ctrl ‘x’ to execute it.

Step 2 :

Now system will be in emergency mode, next step is run a command mentioned below

mount –o  remount,rw/  sysroot

This command is used as by default sysroot is in read only mode. We changed it to read write mode.

Step 3 :

Change the root

chroot  /sysroot

Step 4 :

Type passwd

It will ask you to change the password after running above command then change the root password here.

Step 5:

This command will disabled the SElinux

Type getenforce

Step 6.

After all, Last Step is to load the changes to SElinux

Command is    touch /.autorelabel

Press  exit

Step 6 :

You will have to exit two times then system will reboot, try to login with your new password. Enjoy

Youtube Link : Crack Root Password

You’re done.



Please enter your comment!
Please enter your name here