How to change root password on CentOS Linux
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
singleto 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
passwdcommand:
passwdFollow 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.
