Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question

3 Answers 3

up vote 5 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).

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

Also it's worth checking out the permissions at /var/spool/cron/crontabs by

ls -al /var/spool/cron/crontabs 

In my case doing this showed that actually the user assigned to the crontab was 'whoopsie' which I assume means there was some error in setting up the user.

Performing...

chown <username> /var/spool/cron/crontabs/<username>

Fixed this completely :)

share|improve this answer
    
This worked for me, but the problem was that the actual /var/spool/cron/crontabs directory was unaccessible to users, so the <username> file could not be created. Worth checking that one out too. –  Marco Jan 10 at 22:17

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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