What you will read?
CentOS Single User Mode is a specialized boot mode that provides limited functionality, primarily used for maintenance and administrative tasks. This mode allows system administrators to perform critical operations such as troubleshooting, repairing file systems, or changing passwords without the interference of other users or services. Single User Mode runs as a single user (root) environment without network capabilities, offering a secure setting for essential system repairs.
Booting CentOS into Single User Mode
Booting CentOS into Single User Mode involves a few key steps to ensure safe and controlled access to this maintenance environment. This mode is essential for performing system-level changes without interference from running services or users.
Step 1: Restart Your CentOS System
To begin the process, restart your CentOS system. This can be done from the terminal using the reboot
command or by selecting the restart option through the system’s interface. Ensure that you have administrative privileges to perform this action.
Step 2: Access the GRUB Menu
During the boot sequence, quickly press the Esc
key (or Shift
key for some systems) to access the GRUB menu. The GRUB menu is the boot loader interface where you can modify boot settings and select different boot modes.
Step 3: Modify Boot Parameters
Once in the GRUB menu, highlight the CentOS entry and press e
to edit the boot parameters. Navigate to the line starting with linux
or linux16
and append rd.break
or single
at the end of the line. This modification tells the system to boot into Single User Mode.
Changing the Root Password
To change the root password in Single User Mode, follow these steps to ensure a secure update of your system’s credentials.
Using the ‘passwd
‘ Command
Once the system has booted into Single User Mode and you have gained access to the root shell, remount the system in read-write mode to allow changes:
mount -o remount,rw /
After remounting, use the passwd
command to change the root password:
passwd
You will be prompted to enter the new root password. Make sure to use a strong and secure password that meets your system’s complexity requirements.
Confirming the New Password
Re-enter the password when prompted to confirm it:
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Once you see the confirmation message, the root password has been changed successfully.
Exiting Single User Mode and Rebooting the System
After successfully changing the root password in Single User Mode, it is important to exit this mode properly and reboot the system to return to normal operation.
To exit Single User Mode and reboot, follow these steps:
- Remount the Filesystem in Read-Only Mode (Optional): For added safety, you can remount the root filesystem as read-only before rebooting:
mount -o remount,ro /
- Reboot the System: To restart the system and boot into normal multi-user mode, use the following command:
reboot
Read more: How to Change Password on Ubuntu 24.10The system will now reboot and load with the new root password, enabling you to log in with the updated credentials.