How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?
Linux Linux Commands TroubleShoot Tutorials

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?

Linux system is known for its security features and if you forget your password then is really the pain ass. You have locked out the system and can not perform any administrative task. Breaking cracking or recovering password in CentOS 7 / RHEL 7 is similar as that of doing same in version 6 but, with the introduction of SELinux and systemd have given you some changes. Well here is te key to  Break/Crack/Reset Root Login in CentOS/RHEL 7.

Scenario: My Server IP is 192.168.1.188

Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig

Step 1: Get And Edit GRUB2 Boot Menu

First, we will restart the machine with CTRL+ALT+DEL and once you prompted for grub boot menu select you kernel version using up and down arrow and press ‘e’ to pass some option/argument into the kernel.

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?

Step 2: Pass Agreement and CTRL+X

Now after performing step 1 you will kernel code like structure. so move to last using arrow key (or CTRL+E)and find the line starting with linux16 and press END button and start deleting till ‘ro’ like shown in the image.

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?

after deleting shown lines append(write) rd.break with space after ‘ro’ like this below image

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?

once you edit the boot line and passed your argument(rd.break) press CTRL+X to get this reboot in single mode

Step 3: Remounting Root Partition (READ/WRITE)

After second step your system will restart and will drop you to a shell in single mode. Here we will remount the file system and make it as root with following command

you can confirm that you are in Read/write mode by using the command.

You Will see like this

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?


Step 4: Change Password and chroot

After getting the system into R/W mode you need to change the root of the system and then you mat change the passwd as below.

with the above command, you can change the password of any user along with the root.

How To Break/Crack/Reset Root Login Password On CentOS/RHEL 7 ?

Step 5: SELinux AutoRelabeling

The labeling of SELinux is a very much important thing to do in CentOS/RHEL 7 system because there the SELinux enables and if you missed this step you will not be able to login with you new passwd which you got reset in the previous step. The following command will change and relabeled the SELinux context in the entire system after reboot

Step 6: Reboot System

We have successfully cracked or OS password now we need to get this system reboot with the following command

After reboot, you will be able to use your new root password.


Kapendra
Love to write technical stuff with personal experience as I am working as a Sr. Linux Admin. and every day is a learning day and Trust me being tech geek is really cool.
http://kapendra.com

Leave a Reply