How to change root password on CentOS Linux

To change the root password on CentOS Linux, follow these steps:

  1. Boot into Single User Mode: You can boot your CentOS system into single user mode by adding single to the kernel command line during boot.
  2. Mount the root partition: In single user mode, the root partition will be mounted read-only. To change the root password, you need to mount the root partition read-write. You can do this by running the following command:
mount -o remount,rw /
  1. Change the root password: You can change the root password using the passwd command:
passwd

Follow the prompts to set the new password.

  1. Reboot the system: Once you have changed the root password, you can reboot the system to exit single user mode.

With these steps, you have successfully changed the root password on your CentOS Linux system.

Leave a Comment