chage - 密码更改之间的最短天数

chage - 密码更改之间的最短天数

-1设置为和的“密码更改之间的最短天数”有什么区别吗0

或者也许两个逗号都执行相同的策略?

chage -m -1 user
chage -m 0 user

谢谢您的任何提示,我找不到 chage 手册中描述的 -1 但可以将其设置为-1

Minimum number of days between password change          : -1

答案1

如果你看一下源代码,chage有一条评论解释了它的-1作用:

/*
 * new_fields - change the user's password aging information interactively.
 *
 * prompt the user for all of the password age values. set the fields
 * from the user's response, or leave alone if nothing was entered. The
 * value (-1) is used to indicate the field should be removed if possible.
 * any other negative value is an error. very large positive values will
 * be handled elsewhere.
 */

因此,当您指定时,chage -m -1 <user>它会禁用 minddays 字段。因此,在限制用户更改密码的频率时,使用 a 禁用它与-1将其设置为 0 似乎具有相同的效果。

参考

相关内容