The passwd command changes the password or lists attributes assosciated with the user's login name. Additionally, privileged users may use this command to install or change passwords and attributes assosciated with any login name.
passwd[-l |-d ][-f][-n min][ -x max][-w warn] name
passwd -s [-a]
passwd -g [name]
The behaviour of this command is extremely system-dependent.It asks you to enter your old password, and if that is typed correctly,prompts you to enter your new password twice.The password may be chosen by a unix system or customized by the user. Some system administrators implement password aging which for security reasons forces the user to change the password after a certain period of usage.
Unix updates the corresponding files /etc/passwd and /etc/shadow for every change in password.
/etc/passwd lists information about users.A user can read this file but not write into it. Each field of information is separated from the next by a ':' .An /etc/passwd file dispalys login name, encrypted password,user ID, group Id, comment , default working directory, default working shell.
There is another password file present in /bin directory called /bin/passwd . It is this file that actually gets executed when we change the password. Thus, /bin/passwd is an executable file which permits changing of password, whereas /etc/passwd contains the information about each user.
I shall discuss the options of the passwd command in the next post.