Linux passwd command
The Linux passwd command is used to change a user's password.
Syntax
passwd [-k] [-l] [-u [-f]] [-d] [-S] [username]
Required parameters:
- -d Delete password
- -f Force the user to change the password at the next login
- -w Number of days to warn in advance before the password expires
- -k Updates can only be sent after expiration
- -l Disable account usage
- -S Display password information
- -u Enable a disabled account
- -x Specify the maximum lifetime of the password
- -g Change group password
- Specify the minimum lifetime of the password
- -i Number of days after password expiration before the account is disabled
Optional parameters:
- --help Display help information
- --version Display version information
Examples
Change a user's password
# passwd example //设置example用户的密码 Enter new UNIX password: //输入新密码,输入的密码无回显 Retype new UNIX password: //确认密码 passwd: password updated successfully #
Display account password information
# passwd -S example example P 05/13/2010 0 99999 7 -1
Delete a user's password
# passwd -d lx138 passwd: password expiry information changed.Other extensions
Linux Command Encyclopedia