Cron – User crontab not accessible

cronpermissionsubuntu-14.04

I cannot edit my user crontab without being superuser.

I expected the following to work, but I get an error message:

$ crontab -e
crontabs/gauthier/: fdopen: Permission denied

The following is working, but I don't think I should need sudo to edit my user-specific crontab:

$ sudo crontab -u gauthier -e

The permissions on my user crontab:

$ sudo ls -l /var/spool/cron/crontabs
total 4
-rw------- 1 1001 crontab 1139 Sep 10 08:36 gauthier

I tried adding myself to the crontab group, to no av (I understand now that I shouldn't be in that group, it's only for SGID to work).

An answer to this question says to change the permissions, owner, and group of /usr/bin/crontab, but that file does not seem involved here. And I don't see why these permissions would have changed from system defaults.

Where am I wrong? Is it normal that crontab -e doesn't work? Even if I am in the crontab group? What should I do instead? If I need to change the permissions and owner of /usr/bin/crontab, why aren't they working in the default installation?

Best Answer

The permission for your crontab is wrong, it is owned by an (nonexistant?) user with the uid 1001, not the user gauthier (or you have some further issues with your system if your uid is 1001).

Try sudo chown gauthier /var/spool/cron/crontabs/gauthier and see if this fixes this.