So I ran into the following issue when attempting to setup a user to have cron access on a RHEL 4 box.
Oct 7 10:34:01 ‘hostname’ pam_access[20206]: access denied for user `user’ from `cron’
Oct 7 10:34:01 ‘hostname’ crond[20206]: Permission denied
First and foremost, you should know that any user that you want to be able to user cron should be added to /etc/cron.allow. Almost anyone who is familiar with Cron should already know this.
Poking around a bit on google indicated that I needed to add the following to /etc/security/access.conf
+ALL:cron crond
Make sure that the line above comes before the line below.
-:ALL:ALL
Below is the /etc/pam.d/crond file that I used
#
# 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
Thanks for the advice – helped me with a cron job on XenServer.
Also had to modify the .sh job with ‘chmod u+x jobname.sh’…
Thanks!