Carrying forward from our previous discussions on CentOS, this comprehensive guide will walk you through the process of resetting the administrator password in CentOS 6 and CentOS 7.
Getting Started with CentOS 6 Password Reset:
Reboot Procedure:
Start by rebooting your computer. During the boot-up phase, when prompted, press the indicated button to enter the Grub menu.
If you have multiple kernel images, choose the latest one and press the ‘a’ button.
Editing Boot Parameters:
Once in Grub, navigate to the boot line. Remove “rhgb quiet” if present and add “single” for the reset procedure.
Resetting the Password:
Press enter to boot in single mode. Now, simply type passwd
, set your new password, and reboot the system. Congratulations, your CentOS 6 password is now reset!
CentOS 7 Password Reset: A Different Approach:
Starting the Reset Process:
Reboot your CentOS 7 system and access the boot menu. Select your desired image and initiate the reset process by pressing the ‘e’ button.
Parameter Adjustments:
In the parameter editing section, adjust the necessary lines. Especially focus on the line starting with “linux16.” Modify the “ro” parameter to “rw” and append “init=/sysroot/bin/sh”. Finalize with ctrl+x.
Final Steps:
Post-boot, use the commands chroot /sysroot
followed by passwd
to set your new password. Finish up with the commands touch /.autorelabel
and exit
. Reboot, and your CentOS 7 administrator password will be successfully changed.
Conclusion:
Resetting admin passwords in CentOS doesn’t have to be daunting. With these simple steps, you can easily regain access to your CentOS 6 or CentOS 7 systems.