How to Change a Password in Linux: Root and Other Users

Updated at

To change a password in Linux, whether it's for the root user or any other user, follow these steps:

1. Log in to the Linux system as the user whose password you want to change or log in as the root user.

2. Open a terminal or command prompt.

3. Type the following command to change the password for the current user:


If you want to change the password for another user, use the following command instead:

sudo passwd username

Replace "username" with the actual username of the user whose password you want to change.

4. You will be prompted to enter the current password for the user. If you are changing the root password, you may not be prompted for the current password.

5. Next, you will be prompted to enter the new password. Type the new password and press Enter. Make sure your password is strong and secure.

6. You will be prompted to re-enter the new password to confirm it. Type the new password again and press Enter.

7. If the password change is successful, you will receive a confirmation message.

By following these steps, you can change the password for any user on a Linux system, including the root user. It is recommended to change your passwords regularly to ensure the security of your system.

YottaSrc footer

why choose us?

Better Pricing, Fast SSD Storage and Real 24/7
Technical Support.

control panel icon

Managing Your Site Through CPanel With The Latest Version

security icon

99.8% Uptime Guarantee.
So Focus On Your Work!

support icon
24/7/365 Support

Day or night, rain or shine,
our team is here for you!

cloud backup icon
Daily Backup

Daily & Weekly Backup.
Your Files Are Safe!