passwd

PASSWD(1)                          ç¨æ·å½ä»¤                         PASSWD(1)



å称
       passwd - æ´æ¹ç¨æ·å¯ç

大纲
       passwd [é项] [ç»å½]

æè¿°
       The passwd command changes passwords for user accounts. A normal user
       may only change the password for their own account, while the superuser
       may change the password for any account.  passwd also changes the
       account or associated password validity period.

   å¯ç æ´æ¹
       å¦æææ§å¯ç ï¼é¦åæ示ç¨æ·è¾å¥æ§å¯ç ãå å¯è¿ä¸ªå¯ç ç¶ååå‐
       å¨çå¯ç è¿è¡æ¯è¾ãç¨æ·åªæä¸æ¬¡æºä¼è¾å¥æ£ç¡®å¯ç ãå许è¶çº§ç¨æ·ç¥è¿è¿ä¸ªæ‐
       ¥éª¤ï¼ä»¥ä¾¿æ´æ¹å¿è®°äºçå¯ç ã

       After the password has been entered, password aging information is
       checked to see if the user is permitted to change the password at this
       time. If not, passwd refuses to change the password and exits.

       æ示ç¨æ·è¾å¥ä¸¤æ¬¡æ°å¯ç ã第äºæ¬¡å第ä¸æ¬¡è¿è¡æ¯è¾ï¼å¹¶ä¸éè¦ç¸åæè½æ´æ¹å¯ç ã

       ç¶åï¼æµè¯å¯ç çè´è´£ç¨åº¦ãä¸è¬æ¥è®²ï¼å¯ç åºè¯¥åå« 6 å° 8 ä½å‐
       符ï¼ä»ä¸è¾¹çä¸ä¸ªæå¤ä¸ªéåä¸éæ©ï¼

       ·   å°ååæ¯

       ·   æ°å 0 å° 9

       ·   æ ç¹ç¬¦å·

       Care must be taken not to include the system default erase or kill
       characters.  passwd will reject any password which is not suitably
       complex.

   å³äºç¨æ·å¯ç çæ示
       The security of a password depends upon the strength of the encryption
       algorithm and the size of the key space. The legacy UNIX System
       encryption method is based on the NBS DES algorithm. More recent
       methods are now recommended (see ENCRYPT_METHOD). The size of the key
       space depends upon the randomness of the password which is selected.

       ç±äºç²å¿å°æå¤çéæ©å¯ç ï¼ä¼å±åå¯ç çå®å¨ãç±äºè¿ä¸ªåå ï¼æ¨ä¸åºè¯¥éæ©åºç°å¨è¯å¸ä¸‐
       æèå¿é¡»è¦åä¸æ¥æè½è®°ä½çå¯ç ãå¯ç ä¹ä¸åºè¯¥æ¯ä¸ä¸ªåå‐
       ã许å¯è¯å·ãçæ¥æèè¡éå·ãææè¿äºå¯ä»¥ç¨äºçæµæ¥æ害系ç»å®å¨ã

       You can find advice on how to choose a strong password on
       http://en.wikipedia.org/wiki/Password_strength

é项
       The options which apply to the passwd command are:

       -a, --all
           This option can be used only with -S and causes show status for all
           users.

       -d, --delete
           å é¤ç¨æ·å¯ç (让å®ä¸ºç©º)ãè¿æ¯ç¦ç¨ä¸ä¸ªç¨æ·å¯ç çå¿«éæ¹æ³ãå®å°è®¾ç½®ç»åºå称çè´¦æ·ã

       -e, --expire
           让ä¸ä¸ªè´¦æ·çå¯ç ç«å³è¿æãè¿å¯ä»¥å¼ºå¶ä¸ä¸ªç¨æ·ä¸æ¬¡ç»å½æ¶æ´æ¹å¯ç ã

       -h, --help
           ç°å®å¸®å©ä¿¡æ¯å¹¶éåºã

       -i, --inactive INACTIVE
           This option is used to disable an account after the password has
           been expired for a number of days. After a user account has had an
           expired password for INACTIVE days, the user may no longer sign on
           to the account.

       -k, --keep-tokens
           表示å¯ç æ´æ¹åªåºè¯¥å 为认è¯å£ä»¤(å¯ç )è¿ææ´æ¹ãç¨æ·å¸æä¿æä»ä»¬å°æªè¿æçå£ä»¤ã

       -l, --lock
           éå®æå®è´¦æ·çå¯ç ãæ‐
           ¤é项éè¿å°å¯ç æ´æ¹ä¸ºä¸ä¸ªä¸å¯è½ä¸å å¯å¼å¹éçå¼æ¥ç¦ç¨(å®å¨å¯ç å¼å¤´æ·»å ä¸ä¸ª“!”)ã

           Note that this does not disable the account. The user may still be
           able to login using another authentication token (e.g. an SSH key).
           To disable the account, administrators should use usermod
           --expiredate 1 (this set the account's expire date to Jan 2, 1970).

           被éå®äºå¯ç çç¨æ·ä¸å许æ´æ¹å¯ç ã

       -n, --mindays MIN_DAYS
           Set the minimum number of days between password changes to
           MIN_DAYS. A value of zero for this field indicates that the user
           may change their password at any time.

       -q, --quiet
           å®é模å¼ã

       -r, --repository REPOSITORY
           change password in REPOSITORY repository

       -R, --root CHROOT_DIR
           Apply changes in the CHROOT_DIR directory and use the configuration
           files from the CHROOT_DIR directory.

       -S, --status
           æ¾ç¤ºè´¦æ·ç¶æä¿¡æ¯ãç¶æä¿¡æ¯åå« 7 个å段ãé¦ä¸ªå‐
           段æ¯ç¨æ·çç»å½åï¼ç¬¬äºä¸ªå‐
           段表示ç¨æ·è´¦æ·æ¯å¦å·²ç»éå®å¯ç (L)ã没æå¯ç
           (NP)æèå¯ç å¯ç¨(P)ï¼ç¬¬ä¸ä¸ªå‐
           段ç»åºæåä¸æ¬¡æ´æ¹å¯ç çæ¥æãæ¥ä¸æ¥çå个å‐
           段åå«æ¯å¯ç çæå°å¹´é¾ãæ大年é¾ãè‐
           ¦åæåç¦ç¨æãè¿äºå¹´é¾ä»¥å¤©ä¸ºåä½è®¡ç®ã

       -u, --unlock
           Unlock the password of the named account. This option re-enables a
           password by changing the password back to its previous value (to
           the value before using the -l option).

       -w, --warndays WARN_DAYS
           Set the number of days of warning before a password change is
           required. The WARN_DAYS option is the number of days prior to the
           password expiring that a user will be warned that their password is
           about to expire.

       -x, --maxdays MAX_DAYS
           Set the maximum number of days a password remains valid. After
           MAX_DAYS, the password is required to be changed.

           Passing the number -1 as MAX_DAYS will remove checking a password's
           validity.

CAVEATS
       å¯ç å¤ææ§æ£æ¥å¨æ¯å°æºå¨é´ä¸åãç¨æ·åºè¯¥éæ©éåçå°½éå¤æçå¯ç ã

       å¨å¯å¨äº NIS çç³»ç»ä¸ï¼å¦æ没æç»å½ NIS
       æå¡å¨ï¼ç¨æ·æ许ä¸è½æ´æ¹èªå·±çå¯ç ã

       passwd uses PAM to authenticate users and to change their passwords.

æ件
       /etc/passwd
           ç¨æ·è´¦æ·ä¿¡æ¯ã

       /etc/shadow
           å®å¨ç¨æ·è´¦æ·ä¿¡æ¯ã

       /etc/pam.d/passwd
           PAM configuration for passwd.

éåºå¼
       The passwd command exits with the following values:

       0
           success

       1
           permission denied

       2
           invalid combination of options

       3
           unexpected failure, nothing done

       4
           unexpected failure, passwd file missing

       5
           passwd file busy, try again

       6
           invalid argument to option

åè§
       chpasswd(8), passwd(5), shadow(5), usermod(8).



shadow-utils 4.8                  2019-12-15                         PASSWD(1)