I'm trying to set up a cron job under my user. I run crontab -e, make my edits, and try to save and exit. I receive the following error message /var/spool/cron/: mkstemp: Permission denied
.
Relevant output from ls -al /var/spool/cron/crontabs
drwxr-xr-x 2 root crontab 4096 Nov 4 10:09 .
drwxr-xr-x 5 root root 4096 Nov 19 2014 ..
-rw-rw-rw- 1 greg crontab 91 Nov 4 11:04 greg
-rw------- 1 root crontab 1231 Oct 29 16:18 root
I can directly edit the greg file and save that but I still can't seem to get the job to run, even if I restart cron after updating it. What do I need to do to fix this problem?
The output from ls -lha $(which crontab)
is:
-rwxr-sr-x 1 root crontab 36K Feb 8 2013 /usr/bin/crontab
The output from groups greg
is:
greg : greg adm sudo crontab lpadmin sambashare
Best Answer
This will fix your immediate problem:
But, if you can download packages, a more robust way to fix this is to use
apt-get
to reinstall the appropriate package:after first making sure any local changes you've made to
/etc/init/cron.conf
,/etc/default/cron
, etc. are copied somewhere and then reapplied.