Cron is a daemon in Linux that executes scheduled commands. Cron looks for /var/spool/cron directory for crontab files which are named after user accounts in /etc/passwd file and then found crontabs are loaded into the memory. Cron also searches for /etc/crontab file and the files in the /etc/cron.d directory. On Red Hat systems, crond supports access control with PAM (Pluggable Authentication Modules). A PAM configuration file for crond is installed in /etc/pam.d/crond. Crond loads the PAM environment from the pam_env module, but these can be overridden by settings in the crontab file.
Today my system user account threw below error while listing the crontab,
[root@server01 ~]# /etc/init.d/crond status crond (pid 4282) is running... [root@server01 ~]# crontab -l no crontab for root [root@server01 ~]# crontab -l -u sumitgoel User account has expired You (sumitgoel) are not allowed to access to (crontab) because of pam configuration. [root@server01 ~]# su - sumitgoel sumitgoel@server01 ~ $ crontab -l User account has expired You (sumitgoel) are not allowed to access to (crontab) because of pam configuration. sumitgoel@server01 ~ $
So the first thing to check here is the user account password expiry information and chage is a nice command to show the account aging information.
sumitgoel@server01 ~ $ chage -l sumitgoel Last password change : Apr 13, 2012 Password expires : Jul 12, 2012 Password inactive : Jul 27, 2012 Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 90 Number of days of warning before password expires : 14 sumitgoel@server01 ~ $
The above information clearly shows that the user account password had expired and now I just need to reset the password of my account to fix the issue. But several other things can be checked if you have such issues.
- Make sure crond is running using command:
- Check logs for any errors at
- Make sure user is not listed in
/etc/cron.allowfile exists, then username must be listed in there to allow the use of cron jobs.