Crontab -e You are not allowed to use this program (crontab)

最近注意到有系统创建的普通帐户无法使用crontab,但以root身份运行计划任务是不推荐的。
每次尝试使用普通用户编辑crontab时,收到以下消息:

[miner@cy2 ~] $ crontab -e
You (miner) are not allowed to use this program (crontab)
See crontab(1) for more information

错误
原因为crontab被限制为root帐户使用,普通用户不允许使用crontab创建规则。
有两个文件控制crontab的使用,在/etc目录下:

/etc/cron.allow
/etc/cron.deny

系统首先检查cron.allow,如果不存在则检查cron.deny。如果这两个文件都不存在,那么系统将不允许root用户使用cron。
要允许普通用户使用crontab,必须将用户帐户添加到cron.allow文件中,如下所示:

[miner@cy2 ~] $ su - root
password:
[root@cy2 ~ ] # echo miner> /etc/cron.allow

将miner用户帐户添加到/etc/cron.allow,完成后即可以正常使用crontab:
正常使用

猜你喜欢

转载自blog.csdn.net/cy309173854/article/details/79984575
今日推荐