chance -E 命令的日期格式

chance -E 命令的日期格式

我想知道输入命令的正确格式是什么:

sudo chage -E (DATE) (USERNAME)

此外,是否可以输入小时、分钟和秒。

答案1

man chage

   -E, --expiredate EXPIRE_DATE
       Set the date or number of days since January 1, 1970 on which the
       user's account will no longer be accessible. The date may also be
       expressed in the format YYYY-MM-DD (or the format more commonly
       used in your area). A user whose account is locked must contact the
       system administrator before being able to use the system again.

您需要的是天数,或者是 YYYY-MM-DD 字符串。不考虑一天中的时间。

还请尝试date +%F -d "+30 days"输出从“今天”起 30 天内的日期。

 chage -E $(date +%F -d "+30 days") USER

相关内容