Whenever you forget your root password, it’s a disaster and root password is really important because you can’t even look disk property without being root. Apart from this, you have got much more reasons to reset your CentOs/RHEL password like, forgetting after installation or missed with handling lots of passwords.
Well, this tutorial will help you reset/break ROOT password or you may reset any account password. In this article, we will not use any live OS or other media but we will use recovery method to do so.
By the end of this article, you will be able to reset the root password on your CentOS 5/6 installation.
Server IP: 192.168.1.188
OS: CentOS/RHEL 5/6
Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig
Step 1: Reboot System
If you are not able to login into your CentOS/RHEL server/system then reboot your system using CTRL+ALT+DEL or powering off.
Step 2: Get The GRUB Menu
When the start gets up with booting screen which shows you “Booting With …...”, Just press any key to get this screen. This will show grub screen like below.
Step 3: Select The Kernel
As we are in grub menu select your working kernel version. And press ‘e’ and select the “kernel /vmlinuz-…” line and press the ‘e’ key to pass an argument at run time in the kernel. It’s like editing kernel.
Note: If grub is password protected then you need to press ‘p’ key to enter the enter grub password. Then press ‘e’ key.
Step 4: Pass Option Into Kernel
Now change the boot option of the kernel. To do so, in terminal append 1 or s or single in the end of the line after quiet.
#...... quiet single
Now hit enter to save changes
Note: it should be in small letters
Step: 5 Boot Machine with new kernel option
After you have passed option in the kernel you need to boot system with your passed argument by pressing ‘b’ on the following screen of the kernel /vmlinuz… line.
Note: Pressing the ‘b’ key with this temporary boot option will not affect your system so don’t worry
Step 6: Reset password
Finally, we are here to reset our root password you can also change other user passwords by command passwd. After step 6 you will be prompted for the shell and here type in the following commands
#setenforce 0 #passwd
You will be prompted for typing password two times.
After completion of this command reboot your system with the following command
After, complete reboot of the system type in your new root password
Once you have completed this, reboot and you have a new root password for your CentOS installation. For more, you can watch below video
Watch Video And Don’t Forget To Subscribe:
Subscribe on Youtube