【问题标题】:Run Cron as non root user以非 root 用户身份运行 Cron
【发布时间】:2021-11-18 09:04:51
【问题描述】:

我们使用open-shift,docker容器只能以非root用户运行。

但是,cron 启动失败并出现错误:seteuid: Operation not allowed

我已经做了如下设置,错误依旧

chmod gu+rw /var/run
crontab -u my_user home/my_user/Base/cron.txt
usermod -a -G root,crontab my_user

如何避免错误?

【问题讨论】:

    标签: cron


    【解决方案1】:

    我使用以下方法来解决问题。 希望可以帮助别人

    chmod gu+rw /var/run
    chmod gu+s /usr/sbin/cron
    # Optional
    # chmod g+s, u-s /usr/bin/crontab
    crontab -u my_user /home/my_user/cron.txt
    

    【讨论】:

    • 嗨,Ken (@3944335),我也有类似的要求。我已经在我的 Docker 文件中执行了所有这些步骤,但是在我的容器内启动 cron 时我仍然收到seteuid: Operation not permitted。我使用 ubuntu-20 作为我的基础镜像,知道可能是什么原因吗?
    • 我可以在将我的用户添加到corntab组后运行crontab -u my_user /home/my_user/cron.txt,但我的脚本仍然没有运行,可能是因为cron进程正在运行并且由于权限问题我无法启动它
    猜你喜欢
    • 2013-08-10
    • 1970-01-01
    • 2017-07-08
    • 2017-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-12
    • 2015-04-01
    相关资源
    最近更新 更多