Here's some output that I hope is helpful:

nick@home-sv-1:~$ crontab -e
/var/spool/cron/crontabs/nick: Permission denied

nick@home-sv-1:~$ echo $EDITOR
emacs

nick@home-sv-1:~$ ls /var/spool/cron/crontabs
ls: cannot open directory /var/spool/cron/crontabs: Permission denied

nick@home-sv-1:~$ sudo ls -al /var/spool/cron/crontabs
total 12
drwx-wx--T 2 root crontab 4096 2009-10-25 20:45 .
drwxr-xr-x 3 root root    4096 2009-05-18 01:19 ..
-rw------- 1 root root     612 2009-10-25 01:20 root

Problem:

Crontab does not have setguid, and is not in the crontab group.

home-sv-1:~# ls -al /usr/bin/crontab
-rwxr-xr-x 1 root root 32048 2009-08-30 03:34 /usr/bin/crontab

Solution:

As root...

home-sv-1:~# chown root.crontab /usr/bin/crontab
home-sv-1:~# chmod g+s /usr/bin/crontab

home-sv-1:~# ls -al /usr/bin/crontab
-rwxr-sr-x 1 root crontab 32048 2009-08-30 03:34 /usr/bin/crontab
link|improve this question

58% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Does /usr/bin/crontab have the setgid permission set?

-rwxr-sr-x 1 root crontab 32K 2008-09-28 14:07 /usr/bin/crontab*

If not, chmod g+s it (and if needed, chown before that)


Edit: Note that this only applies to Vixie Cron (used by most distros); other daemons (such as dcron) may use different permissions (setuid).

link|improve this answer
Thank you so much, that's been bugging me for ages! – nbolton Oct 25 '09 at 21:13
feedback

Check for an /etc/cron.allow and /etc/cron.deny file. If those files exist, make sure your user name is in /etc/cron.allow.

link|improve this answer
This would show a different error message - "You ($USER) are not allowed to use this program (crontab)" – grawity Oct 26 '09 at 7:24
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.