How to recover root, we can change and reset the root password in Linux by interrupting the boot process. This is pretty easy to reset and use the same password again.
How to Recover Root Password of Linux Machine:
Step 1: you have to reboot your machine and before booting Press ‘e’ to interrupt the booting process of your machine.
Check Out: Check Inode Number Of a File Or Directory
Then look for a line Linux 16 and write rd.break between initrd16 and Press Ctrl ‘x’ to execute it.
Step 2: Now the system will boot in emergency mode, the next step is to run a command mentioned below.
mount –o remount,rw/ sysroot
This command is used because by default sysroot is in read-only mode. We changed it to read-write mode.
Step 3: Change the sysroot
Step 4: Type passwd
It will ask you to change the password after running the above command then change the root password here.
Check Out: How To Disable Selinux On CentOS7
Step 5: This command will disable the SELinux so
Type getenforce 0
Step 6. After all, the Last Step is to load the changes to SELinux using the command touch /.autorelabel
Press “exit”. so
Step 6: You will have to exit two times then the system will reboot, try to login with your new password enjoy. so
YouTube Link: Crack Root Password
You’re done. linux change root password