Crontab listing or editing results in fopen: permission denied

cronpermissionsubuntu-10.10

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"

Best Answer

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.

Related Topic