原文:https://www.cnblogs.com/Csir/p/6403830.html?utm_source=itdadao&utm_medium=referral
示例:要求oldboy666用户7天内不能更改密码,60天以后必须修改密码,过期前10天通知oldboy666用户,过期后30天禁止用户登录
[root@34moban ~]# useradd oldboy666 [root@34moban ~]# passwd oldboy666 Changing password for user oldboy666. New password: BAD PASSWORD: it is too simplistic/systematic BAD PASSWORD: is too simple Retype new password: passwd: all authentication tokens updated successfully. [root@34moban ~]# passwd -n 7 -x 60 -w 10 -i 30 oldboy666 Adjusting aging data for user oldboy666. passwd: Success [root@34moban ~]# chage -l oldboy666 Last password change : Feb 15, 2017 Password expires : Apr 16, 2017 Password inactive : May 16, 2017 Account expires : never Minimum number of days between password change : 7 Maximum number of days between password change : 60 Number of days of warning before password expires : 10 chage -m 7 -M 60 -W 10 -I 30 oldboy çchage -m7 -M60 -W10 -I30