1、步骤一:在linux服务器上编写shell脚本后,使用crontab -e在嘛术铹砾weblogic用户下设置定时任务,但是发现到了定时任务触发时间后,定时任务未执行。在weblogic用户下手动测试,脚本可以正常执行,怀疑是非root用户权限问题
2、步骤二:查看定时任务的日志/var/log/cron,发现日志中报错如下(weblogic) FAILED to authorize user with PAM (Module is unknown)
3、步骤三:解决方法:修改/etc/pam.d/crond,把把所有required改成sufficient,这邗锒凳审个对非root用户管用## The PAM configuration file for the cron daemon### No PAM authentication called, auth modules not neededaccount sufficient pam_access.soaccount include password-authsession sufficient pam_loginuid.sosession include password-authauth include password-auth
4、步骤四:配置修改后,使用 /etc/init.d/crond restart,重启下crontab使之生效(Centos7使用命令systemctl restart crond重启)
5、再次查看定时任务,已经可以正常执行