今天在CentOS7.4下www用户下执行crontab -e 时出现报错信息,通过查看crontab的日志信息如下,无法使用pam授权用户(身份验证令牌不再有效;需要新的令牌)。

查看crontab日志信息

tail -f /var/log/cron

日志报错信息如下:

Oct 24 09:10:01 iz2ze6rdks1akg4xed25ngz CROND[16489]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Oct 24 09:11:01 iz2ze6rdks1akg4xed25ngz crond[16566]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:11:01 iz2ze6rdks1akg4xed25ngz crond[16566]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:12:01 iz2ze6rdks1akg4xed25ngz crond[16658]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:12:01 iz2ze6rdks1akg4xed25ngz crond[16658]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:13:01 iz2ze6rdks1akg4xed25ngz crond[16726]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:13:01 iz2ze6rdks1akg4xed25ngz crond[16726]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:14:01 iz2ze6rdks1akg4xed25ngz crond[16793]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:14:01 iz2ze6rdks1akg4xed25ngz crond[16793]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:15:01 iz2ze6rdks1akg4xed25ngz crond[16865]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:15:01 iz2ze6rdks1akg4xed25ngz crond[16865]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:16:01 iz2ze6rdks1akg4xed25ngz crond[16939]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:16:01 iz2ze6rdks1akg4xed25ngz crond[16939]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:17:01 iz2ze6rdks1akg4xed25ngz crond[17007]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:17:01 iz2ze6rdks1akg4xed25ngz crond[17007]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:18:01 iz2ze6rdks1akg4xed25ngz crond[17071]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:18:01 iz2ze6rdks1akg4xed25ngz crond[17071]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:19:01 iz2ze6rdks1akg4xed25ngz crond[17139]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:19:01 iz2ze6rdks1akg4xed25ngz crond[17139]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)
Oct 24 09:20:01 iz2ze6rdks1akg4xed25ngz crond[17210]: (www) PAM ERROR (Authentication token is no longer valid; new one required)
Oct 24 09:20:01 iz2ze6rdks1akg4xed25ngz crond[17210]: (www) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)

查看www用户密码有效期

chage -l www
[root@iz2ze6rdks1akg4xed25ngz /]# chage -l www
Last password change                                    : Jul 24, 2019
Password expires                                        : Oct 22, 2020
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 7
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7

由此可见www用户的密码已过期,原密码有效期是90天,导致crontab命令出现执行报错的问题,调整www密码有效期就可以了,一劳永逸的方法是把www密码有效期改为永久,其中99999代表永久,使用如下命令:

chage -M 99999 www

查看www密码有效期已经改为永久了,现在crontab命令就可以正常使用了。

[root@iz2ze6rdks1akg4xed25ngz /]# chage -l www
Last password change                                    : Jul 25, 2019
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 7
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
上一篇 下一篇