The chage command changes the number of days between password changes and the date of the last password change. This information is used by the system to determine when a user must change his/her password.
chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user
Examples:
1.How to set the minimum password expiration date and the maximux expiration date for a user named john:
chage -m 3 -M 30 john
2.How to make a user's account inactive 1 day after his password has expired
chage -I 1 john
3.How to create a expiration date for the user and warn him with 3 days before that his account will expire.
chage -E 2010-03-20 -W 3
4. How to list user information
chage -l kate
Last password change : Mar 02, 2010
Password expires : Jun 30, 2010
Password inactive : Jul 01, 2010
Account expires : Jul 02, 2010
Minimum number of days between password change : 4
Maximum number of days between password change : 120
Number of days of warning before password expires : 7
5.How to remove password inactive and account expires settings.
chage -E -1 -I -1 kate
chage -l kate
Last password change : Mar 02, 2010
Password expires : Jun 30, 2010
Password inactive : never
Account expires : never
Minimum number of days between password change : 4
Maximum number of days between password change : 120
Number of days of warning before password expires : 7
Note : Only chage can help you set an account expiration date passwd can't.
No comments:
Post a Comment