Kunal
Votes: 0Posted On: Nov 09, 2021 12:17:14
You can change your own password or if you are an Admin or a user with Sudo privileges, you are allowed to change passwords for other users as well. In Linux, you can change the password of a user account with the 'passwd' utility. As a regular user, you can only change your own password.
To change your own user’s account password, run the passwd command without any arguments:
# passwd
Now, you need to enter your old password, as this is to prevent others from changing your password. Next, you need to enter the new password twice and make sure that your password meets the complexity rules.
Output
Changing password for user john_doe
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Make sure to meet the following minimal password requirements:
- A password must be strong: at least six or eight characters or more is better.
- Make sure to use complex passwords by mixing letters, numbers, and other characters to make the password as hard to guess.
- Use upper and lowercase letters to make the password harder to crack by an attacker.
- Make sure to avoid using any dictionary word as a password, because attackers use a brute-force password cracker to scan the whole contents of a dictionary, and if your password is in the dictionary, they can easily crack it.
If you are a system admin with root user access, you can change the password of other system users by typing the passwd command followed by the name of the user whose password you want to change.
# passwd john_doe
Output
Changing password for user john_doe
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Note: As a root user, you will not be asked for current password of the user.