SElinux 阻止 cron 运行 Centos 7

Res*_*onx 2 linux centos cron selinux

我正在使用 cronjob 来启动一个脚本,该脚本将在重新启动时触发我的 teampeak

它工作正常一段时间,直到我激活 Selinux,cron 不再工作

我的 cron 日志上有这个错误:

Aug  2 16:14:21 Manu crond[683]: (teamspeak3-user) Unauthorized SELinux context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 file_context=system_u:object_r:unlabeled_t:s0 (/var/spool/cron/teamspeak3-user)
Aug  2 16:14:21 Manu crond[683]: (teamspeak3-user) FAILED (loading cron table)
Run Code Online (Sandbox Code Playgroud)

我在网上搜索,有些人正在谈论一个已知的错误和对我不起作用的解决方法。

请帮助。

添加信息:

ls -lZ /var/spool/cron/teamspeak3-user

-rw-------. teamspeak3-user teamspeak3-user system_u:object_r:unlabeled_t:s0 /var/spool/cron/teamspeak3-user
Run Code Online (Sandbox Code Playgroud)

Tom*_*umi 6

IMOchcon是一个快速解决方案。最好通过语义将其设置为规则:

# semanage fcontext -a -t user_cron_spool_t "/var/spool/cron(/.*)?"
# restorecon -R -vv /var/spool/cron
Run Code Online (Sandbox Code Playgroud)

它将在任何系统更新后继续存在,并自动应用于新用户的 cronjob。