V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
qhy0802he
V2EX  ›  Ubuntu

ubuntu cron 执行失败,急

  •  
  •   qhy0802he · 192 天前 · 1139 次点击
    这是一个创建于 192 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ubuntu cron 执行系统 date 命令后只有日志:Permission denied 。完全没有头绪。
    尝试了关闭 selinux/apparmor
    尝试了调整相关配置文件权限

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

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

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

    说实话我不太信这句日志是 date 产生的
    defunct9
        8
    defunct9  
       192 天前   ❤️ 2
    开 ssh ,让我上去看看
    yolee599
        9
    yolee599  
       192 天前 via Android
    date 指令不需要什么权限的啊
    chauncychan
        10
    chauncychan  
       192 天前
    起码把命令给贴上来吧
    zhanglintc
        11
    zhanglintc  
       192 天前
    开 ssh ,让我上去看看
    Nooooobycat
        12
    Nooooobycat  
       192 天前
    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
        13
    Masoud2023  
       192 天前
    开 ssh ,让我上去看看
    defunct9
        14
    defunct9  
       192 天前
    @zhanglintc @Masoud2023 说这句话要小心 Livid 封了账号
    zhanglintc
        15
    zhanglintc  
       191 天前
    @defunct9 #14 还有这种危险啊?那我以后不说了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5695 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 06:07 · PVG 14:07 · LAX 23:07 · JFK 02:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.