Cron is a daemon in Linux that executes scheduledcommands. Cron looks for /var/spool/cron directory for crontab files which arenamed after user accounts in /etc/passwd file and then found crontabs are loadedinto 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 (PluggableAuthentication 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 inthe crontab file.

Today mysystem user account threw below error while listing the crontab,

[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 informationand chage is a nice command to show the accountaging information,

# chage -l<username>

Most likely the user account password has expired and now we just need to resetthe password of the user account to fix the issue. If this is your serviceaccount and the password is used at countless places where you just cannotchange the password on the fly then simply disable the password expiration forthe account,

# chage -I -1 -m 0-M 99999 -E -1 <username>

You should be all good now but several other things can be checked if you havethis issue,

  • Make sure crond is running using command: /etc/init.d/crond status
  • Check logs for any errors in /var/log/cron and /var/log/messages files.
  • Make sure the user is not listed in /etc/cron.deny file.
  • If /etc/cron.allow file exists, then username must be listed in there to allow the use of cron jobs.

Any feedbackwill be highly appreciated.

Suggested Posts,


This post appeared on the softlexicon.combySumit Goel.Copyright © 2012–2013 –softlexicon.comand Sumit Goel.All rights reserved. Not to be reproduced for commercial purposes withoutwritten permission.

Logo

更多推荐