Forgetting password is one of the most irritating things for a system administrator. What happens if you forget the root password in your Red Hat Enterprise Linux 7 (RHEL 7) system. Don’t worry, there is always a solution for a problem. The process of resetting or breaking root password in RHEL 7 is a little bit different from the process we use to reset or break root password in RHEL 6. You have to be extra careful while breaking root password in RHEL 7. In this post, we will explain how to break root password in RHEL 7.
- Also read: Reset root password in Ubuntu 17.04
We assume that you have already installed RHEL 7 on your system, if not, visit the following link to install your RHEL 7 system on VMware Workstation or Player as a virtual machine.
To break root password in RHEL 7, you need to perform the following steps:
- Reboot your RHEL 7 system and interrupt the booting process.
- Type “e” into kernel name on the corresponding starting item when the system startup.
- Find the text linux16, locate and replace “ro” to ”rw init=/sysroot/bin/sh” and then press the ctrl+x keys.
- After making the preceding changes, your kernel script should look like the following.
- Next, execute the following command to mount the root to /sysroot/
- Next, execute the following command to set a new password for root.
Note: If this command does not work, try the password -d root command to remove the root password and set the desired password later.
- Next, execute the following commands to relabel the file systems and exit from the sysroot.
#touch /.autorelabel #exit
- Finally, execute the following command to reboot your RHEL 7 system.
- The following figure shows the commands that you need to execute to break root password in RHEL 7.
- Now, the system will be rebooted and after a while, you will be able to login with the newly set password.
That’s all you need to break root password in RHEL 7. Please drop your queries if you have something to say.