qhy0802he
V2EX  ›  Ubuntu

ubuntu cron 执行失败,急

  •  
  •   qhy0802he · Oct 19, 2023 · 2742 views
    This topic created in 1117 days ago, the information mentioned may be changed or developed.
    ubuntu cron 执行系统 date 命令后只有日志:Permission denied 。完全没有头绪。
    尝试了关闭 selinux/apparmor
    尝试了调整相关配置文件权限

    还有啥好办法?在线等
    Supplement 1  ·  Oct 23, 2023
    统一回复,谢谢各位大佬,经过排查测试发现是 pam.d/cron 配置问题,导致验证失败。已修复
    15 replies  •  2023-10-20 13:00:23 +08:00
    wheat0r
    wheat0r
    Oct 19, 2023
    1
    这信息也太少了
    devswork
    devswork
    Oct 19, 2023
    2
    命令前面加上 sudo

    编辑 sudoers:
    myuser ALL=(ALL:ALL) NOPASSWD: /bin/date
    myuser 是你的用户名,/bin/date 是 date 命令的绝对路径

    再试下看看能不能行
    devswork
    devswork
    Oct 19, 2023
    3
    我用的 centos7 ,date 命令路径是 /usr/bin/date
    ubuntu 可以用下 whereis date 来查下命令的绝对路径
    AoEiuV020JP
    AoEiuV020JP
    Oct 19, 2023
    4
    按理说 date 不需要啥搞权限的,而且 cron 正常来说是 root 权限的,
    总之 cron 里运行 id 命令看看情况,
    Hf1G1sGBYS8QSLN8
    Hf1G1sGBYS8QSLN8
    Oct 19, 2023
    5
    着急就手动执行一下。
    thinkm
    thinkm
    Oct 19, 2023
    6
    调试一下
    julyclyde
    julyclyde
    Oct 19, 2023
    7
    是系统级 crontab 还是用户级 crontab 啊?
    把 crond 的日志上下文都发上来看看

    说实话我不太信这句日志是 date 产生的
    defunct9
    defunct9
    Oct 19, 2023❤️2
    8
    开 ssh ,让我上去看看
    yolee599
    yolee599
    Oct 19, 2023 via Android
    9
    date 指令不需要什么权限的啊
    chauncychan
    chauncychan
    Oct 19, 2023
    10
    起码把命令给贴上来吧
    zhanglintc
    zhanglintc
    Oct 19, 2023
    11
    开 ssh ,让我上去看看
    Nooooobycat
    Nooooobycat
    Oct 19, 2023
    12
    Apache: Troubleshooting any problem without the error log is like driving with your eyes closed.

    https://httpd.apache.org/docs/2.4/getting-started.html
    Masoud2023
    Masoud2023
    Oct 19, 2023
    13
    开 ssh ,让我上去看看
    defunct9
    defunct9
    Oct 19, 2023
    14
    @zhanglintc @Masoud2023 说这句话要小心 Livid 封了账号
    zhanglintc
    zhanglintc
    Oct 20, 2023
    15
    @defunct9 #14 还有这种危险啊?那我以后不说了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3244 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 10:15 · PVG 18:15 · LAX 02:15 · JFK 05:15
    ♥ Do have faith in what you're doing.