大网数据广告活动
服务器运维问答

crontab listing or editing results in fopen: permission denied

· 52CE 我爱测

Recently, a job configured to run from a user's crontab stopped executing. When attempting to list or edit the crontab for the user, the result is: user@host:~$ crontab -l crontabs/user/: fopen: Permission denied user@host:~$ cro…

问题原文

原帖链接 · stantonk · CC BY-SA 3.0

Recently, a job configured to run from a user's crontab stopped executing. When attempting to list or edit the crontab for the user, the result is:

user@host:~$ crontab -l
crontabs/user/: fopen: Permission denied

user@host:~$ crontab -e
crontabs/user/: fdopen: Permission denied

Clearly it is permissions related, though I'm not sure how the permissions got changed -- and more importantly, what they should be set to.

Permissions on /usr/bin/crontab:

$ ll /usr/bin/crontab
-rwxr-sr-x 1 root libuuid 35896 Aug 24  2010 /usr/bin/crontab*

Permissions on /var/spool/cron/crontab directory:

# ll /var/spool/cron/
total 12
drwxr-xr-x 3 root root    4096 Oct 12  2010 ./
drwxr-xr-x 7 root root    4096 Jun  5 20:51 ../
drwx-wx--T 2 root libuuid 4096 Jan 10  2014 crontabs/

Permissions inside crontab directory:

# ll /var/spool/cron/crontabs/
total 16
drwx-wx--T 2 root libuuid 4096 Jan 10  2014 ./
drwxr-xr-x 3 root root    4096 Oct 12  2010 ../
-rw------- 1 1017 libuuid 1120 Dec  3  2013 
-rw------- 1 root libuuid 1342 Jan 10  2014 root

Distro info:

# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

已采纳解答

原帖链接 · mdpc · CC BY-SA 3.0

The permissions on /usr/bin/crontab should be:

 owner=root
 group=root
 perms= 4755  (rws rx rx)

Your /usr/bin/crontab has the wrong group owner. Additionally, it has sgid and NOT suid which it must have.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-08-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。