The passwd command is used to either set the user’s initial password or modify the user’s existing password. The syntax of the passwd command is as follows:
The root user can set the password for any user to any value without knowing his current password. As a regular user, simply type the command at the CLI. You’ll see something like this in response:
$ passwd Changing password for geek. Old Password:
Once you’ve entered the old password, you’re asked for the new one, and then asked to repeat it. If you enter the same new password twice, it’s changed. It looks like this. Note that the actual passwords you’ve typed do not show up on the screen.
New password: Re-enter new password: Password changed.
passwd command examples
1. To lock the user account:
2. To unlock the user account:
3. To delete the password for the user account:
4. To expire the password for the user account:
5. To set the min / max password life
# passwd -n 10 geek # passwd -x 100 geek
6. To set warning message time:
7. To set the user account inactivity time:
8. To get the short info about user account passwd: