格式:chage [OPTION]… LOGIN
-l UserName:查看帐户密码属性信息
-d YYYY-MM-DD Username:设置账户最近一次密码修改时间;用户登录必需修改密码(-d 0)
-E YYYY-MM-DD Username:设置账户过期时间;如为-1则表示用户一直可用
-I N UserName:N为数字;指定密码过期天数(密码过期后多少天用户被锁定);在此时间段内用户依然可以登录系统并更改密码
-m N UserName:N为数字;指定密码最小使用天数(密码使用最小多少天才可更改密码);默认为0表示无限制(禁用此功能)
-M N UserName:N为数字;指定密码最大使用天数(密码使用最大多少天需要更改密码);默认为99999永不过期
-W N UserName:N为数字;指定密码过期前警告天数(密码过期前多少天警告用户更改密码);默认过期前7天警告
-l UserName:查看帐户密码属性信息
-d YYYY-MM-DD Username:设置账户最近一次密码修改时间;用户登录必需修改密码(-d 0)
-E YYYY-MM-DD Username:设置账户过期时间;如为-1则表示用户一直可用
-I N UserName:N为数字;指定密码过期天数(密码过期后多少天用户被锁定);在此时间段内用户依然可以登录系统并更改密码
-m N UserName:N为数字;指定密码最小使用天数(密码使用最小多少天才可更改密码);默认为0表示无限制(禁用此功能)
-M N UserName:N为数字;指定密码最大使用天数(密码使用最大多少天需要更改密码);默认为99999永不过期
-W N UserName:N为数字;指定密码过期前警告天数(密码过期前多少天警告用户更改密码);默认过期前7天警告
-l UserName:查看帐户密码属性信息
[root@localhost ~]# chage -l user3 Last password change : Dec 15, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
Last password change:账户最近一次密码修改时间
Password expires:密码过期时间
Password inactive:密码失效时间
Account expires:帐户过期时间
Minimum number of days between password change:改密相距最小天数
Maximum number of days between password change:改密相距最达天数
Number of days of warning before password expires:密码过期前警告天数
-d YYYY-MM-DD Username:设置账户最近一次密码修改时间;用户登录必需修改密码(-d 0)
[root@localhost ~]# chage -d 2017-03-20 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
[root@localhost ~]# chage -d 0 user3 [root@localhost ~]# chage -l user3 Last password change : password must be changed Password expires : password must be changed Password inactive : password must be changed Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
-E YYYY-MM-DD Username:设置账户过期时间;如为-1则表示用户一直可用
[root@localhost ~]# chage -E 2017-03-20 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : Mar 20, 2017 Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
[root@localhost ~]# chage -E -1 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
-I N UserName:N为数字;指定密码过期天数(密码过期后多少天用户被锁定);在此时间段内用户依然可以登录系统并更改密码
[root@localhost ~]# chage -I 5 user3 [root@localhost ~]# chage -l user3 Last password change : Jul 17, 2017 Password expires : Jul 19, 2017 Password inactive : Jul 24, 2017 Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 2 Number of days of warning before password expires : 7
说明:如密码最大使用天数为永不过期时则密码过期天数配置无效
-m N UserName:N为数字;指定密码最小使用天数(密码使用最小多少天才可更改密码);默认为0表示无限制(禁用此功能)
[root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7 [root@localhost ~]# chage -m 5 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 5 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
-M N UserName:N为数字;指定密码最大使用天数(密码使用最大多少天需要更改密码);默认为99999永不过期
[root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 5 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7 [root@localhost ~]# chage -M 30 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : Apr 19, 2017 Password inactive : Apr 24, 2017 Account expires : never Minimum number of days between password change : 5 Maximum number of days between password change : 30 Number of days of warning before password expires : 7
-W N UserName:N为数字;指定密码过期前警告天数(密码过期前多少天警告用户更改密码);默认过期前7天警告
[root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : Apr 19, 2017 Password inactive : Apr 24, 2017 Account expires : never Minimum number of days between password change : 5 Maximum number of days between password change : 30 Number of days of warning before password expires : 7 [root@localhost ~]# chage -W 15 user3 [root@localhost ~]# chage -l user3 Last password change : Mar 20, 2017 Password expires : Apr 19, 2017 Password inactive : Apr 24, 2017 Account expires : never Minimum number of days between password change : 5 Maximum number of days between password change : 30 Number of days of warning before password expires : 15
Ubuntu系统请配合sudo使用:sudo chage