To change the root password on CentOS Linux, follow these steps:
- 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. - 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 /
- Change the root password: You can change the root password using the
passwd
command:
passwd
Follow the prompts to set the new password.
- 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.