Password Reset - CentOS 7/8/9
Publisher: Psychz Networks, August 13,2025
How to Reset Root Password on CentOS 7/8/9
If you’ve lost or forgotten your root password on CentOS, you can reset it using IPMI and the GRUB bootloader.
This guide will walk you through the process step-by-step.
Prerequisites
- IPMI access to your server
- CentOS 7, 8, or 9 ISO (for rescue boot if required)
- Basic familiarity with Linux command-line
Step 1: Connect to the IPMI
You will need to access your server’s IPMI interface to perform the reset. Refer to our guide on how to connect to IPMI: How to Access Your Dedicated Server via IPMI
Alternatively, you can download and use IPMIView from Supermicro: Download IPMIView
Step 2: Mount the ISO via IPMI
Booting your server into rescue mode by mounting the CentOS ISO. Refer to our guide here: How to Mount ISO via IPMI Management Web Interface
Step 3: Reboot and Access GRUB Menu
- If your system is currently running, reboot it via IPMI.
- When the GRUB boot menu appears, highlight the first boot entry.
- Press e to edit the selected entry.
Step 4: Edit the Kernel Boot Parameters
- In the GRUB editor, find the line starting with: linux16
- Navigate to the end of the line.
- Add:
(Ensure there is a space before rd.break)
Example: linux16 /vmlinuz-3.10.0-327.28.3.el7.x86_64 root=UUID=xxxx ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8 rd.break
Step 5: Boot into Emergency Mode
- Press Ctrl + X to boot with the modified parameters.
- The system will boot into the initramfs prompt with a root shell.
Step 6: Remount the Root Filesystem with Write Permissions
By default, the root filesystem is mounted as read-only at /sysroot.
Remount it as read/write:
Step 7: Enter chroot Environment
Change root into /sysroot so that commands affect the actual system:
Step 8: Reset the Root Password
Run the passwd command:
Enter your new password twice when prompted.
Step 9: Update SELinux Relabel Timestamp
To ensure SELinux relabels the filesystem properly:
Step 10: Exit and Reboot
1.Exit the chroot environment:
2.Exit the initramfs shell:
The system will now reboot.
Step 11: Log In with the New Password
Once the system boots, you can log in as root using the new password.
You have successfully reset your CentOS root password.