zoukankan      html  css  js  c++  java
  • crontab定时任务

    定时任务没有运行,查看cron运行日志
    tail -f /var/log/cron
    报如下错误:
    May 8 10:14:01 localhost crond[9399]: (root) FAILED to authorize user with PAM (Module is unknown)
    May 8 10:14:01 localhost crond[9400]: (root) FAILED to authorize user with PAM (Module is unknown)

    解决办法:
    1、禁用SELinux,可以使用getenforce命令查看是否禁用。

    2、查看用户密码是否过期chage -l root,修改为永不过期(命令:chage -M 9999 root,文件:vi /etc/shadow)

    2、修改/etc/cron.allow,添加要运行定时任务的用户
    root
    myuser

    3、修改/etc/pam.d/crond,把session required改成session sufficient,这个对非root用户管用,root用户不需要修改该文件

    #
    # The PAM configuration file for the cron daemon
    #
    #
    # No PAM authentication called, auth modules not needed
    account    required pam_access.so
    account    include    password-auth
    # session    required pam_loginuid.so
    session    sufficient pam_loginuid.so
    session    include    password-auth
    auth       include    password-auth

    4、重启crond服务
    /etc/init.d/crond restart

    参考链接:
          https://www.generateit.net/cron-job/index.php      #在线生成定时任务
          https://www.cnblogs.com/zoulongbin/p/6187238.html
          http://www.tracefact.net/tech/080.html
          https://www.cnblogs.com/fuhai0815/p/14338928.html
          https://opensource4admin.wordpress.com/2014/07/31/failed-to-authorize-user-with-pam-module-is-unknown-solved/

  • 相关阅读:
    将1、2、3..10...变成01、02、03...10...
    idea启动项目时报错
    八锁现象
    友联
    通达OA 任意文件删除结合文件上传导致RCE漏洞复现
    Linux提权
    vulnhub靶机DC2记录
    ThinkPHP5.x 任意代码执行漏洞复现
    SaltStack远程命令执行漏洞复现(CVE-2020-11651、CVE-2020-11652)
    vulnhub靶机DC1记录
  • 原文地址:https://www.cnblogs.com/xwupiaomiao/p/14967329.html
Copyright © 2011-2022 走看看