passwd is command or tool in Unix/Linux-based operating systems which enables the user to change or configure Password of a User account. The password entered by user is run through a Key Derivation Function which converts the plain text to equivalent hash which is encrypted one. Original password is not saved anywhere for security reasons, only this hashed version of new password is stored in /etc/passwd file. Hashed version of plain text is usually calculated by using DES algorithm.
*** Note all the following information is tested on Ubuntu 11.10. We endeavor to keep the information up-to-date and correct, However, we cannot guarantee that information given on the site is accurate or up to date.
Syntax : passwd [options] [LOGIN]
Here LOGIN is the user-id whose password you want to change. If you want to change password of current user account, then there is no need to mention you user-id, but if you want to change password information of another user’s account, then you have to mention user-id.
Following table shows all the available Options which you can use to configure password of a user account with passwd command/tool.
|
Option Available |
Working |
|
-a, –all |
report password status on all accounts can be used with -S option only |
|
-d, –delete |
delete the password for the named account |
|
-e, –expire |
force expire the password for the named account |
|
-r, –repository REPOSITORY |
change password in REPOSITORY repository Available Repositories : files, nis or nisplus. |
|
-l, –lock |
lock the password of the named account |
|
-S, –status |
report password status on the named account |
Here are some of the working examples of this command
- Changing the password of current account without using any option
For this you can refer to another article which can be found here. - Changing the password of current account without using any option
Type in the following command to change password for another user’s account. For this you must have Super User rights, otherwise it will show an error “You may not view or modify password information for [user-id]“. In the following example, I am changing password of the User account with user-id howtoideas.sudo passwd howtoideasIt will ask you the password of the current account to use
sudocommand and then it will ask you to enter new password of the other user account twice, and then it will show you an output message as shown in following image. - Deleting password using
-doption
Next time your Operating System will not ask for a password to log into this account. In the following example I am changing the deleting the password of howtoideas user account. If you want to delete password of your own account, then there is no need to add user-id at the end of command.sudo passwd -d howtoideasHere is an image of the tested command.
- Forcefully expires the password of a user account using
-eoption
This will expire the current password of the user account and next time when this user tries to log into his account, System will ask the user to enter new password as enforced by root. Following command will expire the password of howtoideasuser account.sudo passwd -e howtoideasFollowing image shows the working of this command.
In following image, I am trying to log into howtoideas account, and see Terminal is asking to change the current password as enforced by root.
- Lock account password using
-loption
This option will lock the user account password and user will not be able to log into his account even after providing correct information. In the following command I am locking the howtoideasuser account password.sudo passwd -l howtoideasFollowing image shows the output of upper command.
Now if i try to log into howtoideas account, I won’t be able to do so, even after providing correct password as shown in the following image.
- Checking status of a particular account or all the accounts using
-Soption
This option will show the status information of a user account. The information shown is in the following ordername status mm/dd/yy min max warn
name The login ID of the user. status Status of the name:
PS or P = Password Enabled account
LK or L = Locked
NP = No Password
NL = No login accountmm/dd/yy The month date and year that the password was last changed. min The minimum number of days between password changes. max The maximum number of days the password is valid for the name. warn The number of days relative to max before the passwd uses pam for password management. Following command will showing the information of howtoideas account.
sudo passwd -S howtoideasFollowing image shows the output of upper command. See the L character in image after howtoideas in the output which shows that the account is locked. This is because in previous point I locked this account for example purpose.
- Checking status of a particular account or all the accounts using
-Sand-aFollowing command will output the password status information of all the account present in the system.
sudo passwd -S -aFollowing image shows the output of upper command
Incoming search terms:
- internet terminal password (1)







