Linux Classes
Share This With a Friend  

passwd command help

       passwd - update a user's authentication tokens(s)


       passwd [-k] [-l] [-u [-f]] [-d] [-S] [username]


       Passwd is used to update a user's authentication token(s).
       Passwd is configured to work through  the  Linux-PAM  API.
       Essentially,  it  initializes itself as a "passwd" service
       with Linux-PAM and utilizes configured password modules to
       authenticate and then update a user's password.
       A  simple  entry  in  the Linux-PAM configuration file for
       this service would be:
        # passwd service entry that does strength checking of
        # a proposed password before updating it.
        passwd password requisite \
                    /usr/lib/security/ retry=3
        passwd password required \
                    /usr/lib/security/ use_authtok
       Note, other module-types are not required for this  appli­
       cation to function correctly.


       -k     The option, -k, is used to indicate that the update
              should only be for  expired  authentication  tokens
              (passwords);  the  user  wishes  to keep their non-
              expired tokens as before.
       -l     This option is used to lock the  specified  account
              and  it  is  available to root only. The locking is
              performed by rendering the encrypted password  into
              an  invalid  string  (by  prefixing  the  encrypted
              string with an !).
              This option is used to indicate that passwd  should
              read  the  new  password from standard input, which
              unlock  the account password by removing the ! pre­
              fix. This option is  available  to  root  only.  By
              default passwd will refuse to create a passwordless
              account (it will not unlock  an  account  that  has
              only  "!"  as a password). The force option -f will
              override this protection.
       -d     This is a quick way to disable a  password  for  an
              account.  It  will  set the named account password­
              less. Available to root only.
       -S     This will output a short information about the sta­
              tus  of the password for a given account. Available
              to root user only.

Remember the following two principles

       Protect your password.
              Don't write down your password - memorize  it.   In
              particular,  don't  write it down and leave it any­
              where, and don't place it in an  unencrypted  file!
              Use  unrelated  passwords for systems controlled by
              different organizations.  Don't give or share  your
              password,  in  particular to someone claiming to be
              from computer support or a vendor.  Don't let  any­
              one  watch  you  enter  your password.  Don't enter
              your password to a computer you don't trust  or  if
              things  Use  the  password  for  a limited time and
              change it periodically.
       Choose a hard-to-guess password.
              passwd will try to  prevent  you  from  choosing  a
              really bad password, but it isn't foolproof; create
              your password wisely.  Don't  use  something  you'd
              find  in  a dictionary (in any language or jargon).
              Don't use a name (including that of a spouse,  par­
              ent,  child, pet, fantasy character, famous person,
              and location) or any variation of your personal  or
              account  name.   Don't  use  accessible information
              about you  (such  as  your  phone  number,  license
              plate,  or social security number) or your environ­
              ment.  Don't use a birthday  or  a  simple  pattern
              (such  as  backwards,  followed by a digit, or pre­
              ceded by a digit. Instead, use a mixture  of  upper
              and  lower case letters, as well as digits or punc­
              tuation.  When choosing a new password,  make  sure
              it's  unrelated  to any previous password. Use long
              passwords (say 8 characters long).  You might use a
              word  pair  with punctuation inserted, a passphrase
       These principles are partially enforced by the system, but
       only partly so.  Vigilence on your part will make the sys­
       tem much more secure.


       On successful completion of its task, passwd will complete
       with exit code 0.  An exit code of 1  indicates  an  error
       occurred.   Textual  errors  are  written  to the standard
       error stream.


       Linux-PAM (Pluggable Authentication modules for Linux).
       Note, if your distribution of Linux-PAM  conforms  to  the
       Linux  Filesystem  Standard,  you  may find the modules in
       /lib/security/ instead of /usr/lib/security/, as indicated
       in the example.


       /etc/pam.d/passwd - the Linux-PAM configuration file


       None known.


       pam(8), and pam_chauthok(2).
       For  more  complete  information  on how to configure this
       application  with  Linux-PAM,  see  the  Linux-PAM  System
       Administrators' Guide at


       Cristian Gafton <>


Comments - most recent first
(Please feel free to answer questions posted by others!)

virus     (23 Sep 2012, 08:06)
hi Vishal P
Sudo stand for "super user do"..
its work as apply as administer like in give u temporally accessibility on the system for installing application in linux system.
shan     (23 Mar 2012, 22:27)
How to verify when root password was changed in GNU Linux. I want to know in past 6 month how many times it was changed and when was it changed.
Sin     (17 Jan 2012, 23:15)
Im trying to set the same password for multiple users.. im using sudo passwd ace (ace being the username) and then im asked for the password.. but how do i add multiple users int hat same line of code?.. any help would be awesome
Firoz Ahmed     (21 Sep 2011, 09:04)
How can I give password when I create a new user using "adduser" command
Vishal P     (07 Jun 2011, 02:07)
What is SUDO in ubantu ?
yassir abdallah     (24 Feb 2011, 03:51)
i want to change my password in linux, but i forgot the old one. so how can I change my password another way?
kenneth robinson     (27 Dec 2010, 17:57)
i would like to change my password from the one i have now how do i do that
rejiphilip48     (19 Dec 2010, 23:39)
how to change my password?
Bob Rankin     (12 Dec 2010, 12:49)
@zaralee - Logging in as root is the same as logging in as any other user. "root" is the username, there's nothing special about it, in terms of logging in.
zaralee     (07 Dec 2010, 09:56)
how do you log in as root? i dont know what this means. Please explain.
Bob Rankin     (03 Aug 2010, 15:16)
@Sarah - You'll need to login as root, or have someone with root privileges issue the passwd command.
Sarah     (03 Aug 2010, 14:57)
I want to change my password but i forgot the old one. so how can I change my password another way?
ThomasG     (15 Jul 2010, 14:55)
We adopted this Knoppix Linux, which is ok, and it has this CUPS software which governs print jobs. It wants the system username and password(root), in order to just cancel a printjob that is stuck. Would it also be possible to use a pw from the 'console'? Thankyou for this course, it is realy fine.
Dustin Jacobsen     (05 Jun 2010, 11:09)
i need to change my e-mail password.
charlene     (31 May 2010, 10:07)
will these stop me from down loading,and others that use my computer, i dont no one to down load anything but me.
kapoor     (28 May 2010, 23:57)
how can not password skip
denise lacon     (28 May 2010, 20:59)
denise lacon     (28 May 2010, 20:51)
denise lacon     (28 May 2010, 20:39)
iwant to change this because my friends have it.
sukhpreet     (28 May 2010, 10:27)
@nuri, to change ur password, u have to login by root , the superuser and then put the passwd command for the user ,
it will change the password,
Gideon C. Gucilatar     (07 May 2010, 22:02)
How to change my password?
Nuri     (04 May 2010, 05:37)
I want to can my password because all my friends know the password so,how can i change my password.

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
Notify me about new comments on this page
Hide my email

Ask Bob Rankin - Free Tech Support

Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.