白云岛资源网 Design By www.pvray.com
相信很多人看完docker容器, 需要加crontab, 加完却发现不能执行,心塞.....接着便开始各种折腾...
首先当然是看日志了, 发现/var/log 下面没有任何信息, 那是因为你没有打开rsyslog.
# /etc/init.d/rsyslog start
继续看日志
# tail /var/log/crond Dec 29 16:39:01 web01-50794 crond[2839]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:40:01 web01-50794 crond[2842]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:40:01 web01-50794 crond[2841]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:41:01 web01-50794 crond[2846]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) # tail /var/log/secure Dec 29 16:39:01 web01-50794 crond[2839]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:40:01 web01-50794 crond[2841]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:40:01 web01-50794 crond[2842]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:41:01 web01-50794 crond[2846]: pam_loginuid(crond:session): set_loginuid failed # tail /var/log/crond Dec 29 16:39:01 web01-50794 crond[2839]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:40:01 web01-50794 crond[2842]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:40:01 web01-50794 crond[2841]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) Dec 29 16:41:01 web01-50794 crond[2846]: (root) FAILED to open PAM security session (Cannot make/remove an entry for the specified session) # tail /var/log/secure Dec 29 16:39:01 web01-50794 crond[2839]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:40:01 web01-50794 crond[2841]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:40:01 web01-50794 crond[2842]: pam_loginuid(crond:session): set_loginuid failed Dec 29 16:41:01 web01-50794 crond[2846]: pam_loginuid(crond:session): set_loginuid failed
从crontab的日志可以看出是因为pam的原因无法建立一个session连接.
接着看secure日志, 报出了set_loginuid failed , 无法获取用户uid.
分析:
为什么在docker里面无法获取uid"color: #ff0000">解决方案:
# cat /etc/pam.d/crond account required pam_access.so account include password-auth #session required pam_loginuid.so #注释此行 session include password-auth auth include password-auth # cat /etc/pam.d/crond account required pam_access.so account include password-auth #session required pam_loginuid.so #注释此行 session include password-auth auth include password-auth
以上所述是小编给大家介绍的docker容器中crontab无法正常运行解决方案,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com
暂无评论...