How to change root password on CentOS Linux

How to change root password on CentOS Linux

To change the root password on a CentOS Linux system, you can use the passwd command. This command allows you to update the password for the root user or any other user on the system.

To change the root password, log in to the system as the root user and run the passwd command. You will be prompted to enter the new password for the root user.

For example, to change the root password, you can run the following command:

refe‮al:ot r‬utturi.com
passwd

You will be prompted to enter the new password, and then to confirm the new password by entering it again.

It's worth noting that the passwd command uses the libcrypt library to hash the password, so the password is not displayed on the screen as you type it. This helps to protect the password from being observed by others.

After entering the new password, the passwd command will update the password for the root user and write the hashed password to the /etc/shadow file.

It's also a good idea to use a strong password to protect the root user account. A strong password should be at least 8 characters long and include a combination of upper and lower case letters, numbers, and special characters.

It's worth noting that the passwd command can also be used to change the password for any other user on the system. To change the password for a different user, you can use the passwd command followed by the username.

For example, to change the password for the user alice

passwd alice
Created Time:2017-10-28 21:38:58  Author:lautturi