How to fix Cron Authentication Failure error in Linux?

Updated on September 3, 2017

Recently I was bogged with an error “Authentication Failure” for all of my cron jobs in Linux. After googling, I could find a solution for it. If you suspect that your cron jobs are not running, then quickly jump to /var/log/cron and check out the error message. If the problem was due to “Authentication Failure“, then here’s a solution that worked for me. Any user that you want to be eligible for running cron jobs should be listed in /etc/cron.allow (one user per line). If cron.allow file doesn’t exist, but /etc/cron.deny file exists,  then the user must not be listed in it. In case, if both the files doesn’t exist, then only ‘root’ user is eligible for running cron jobs. Alright, if you have been using Linux for quite sometime, then this is not rocket science.

Also check ‘/etc/security/access.conf‘ for the below line, if you don’t find one, then just add it.

+ALL:cron crond

Make sure you add it before -:ALL:ALL

Now, open /etc/pam.d/crond and add these lines.


#
# The PAM configuration file for the cron daemon
#
#
auth       sufficient pam_rootok.so
auth       required   pam_stack.so service=system-auth
auth       required   pam_env.so
account    sufficient /lib/security/$ISA/pam_localuser.so
account    required   pam_stack.so service=system-auth
account    required   pam_access.so
session    required   pam_limits.so
session    required   pam_loginuid.so

That’s it. Checkout sample cron job to ensure that the things are working as expected.

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment