30

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

4 Answers 4

15

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).

0
20

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 :)

1
  • 1
    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. Jan 10, 2014 at 22:17
8

I had the same problem. I solved it this way.

sudo crontab -u yourUser -e

I hope it helps you.

1

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.

1
  • 1
    This would show a different error message - "You ($USER) are not allowed to use this program (crontab)" Oct 26, 2009 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .