When I use the command crontab -e on my Debian server as a non root user (in this case as postgres), I can't edit it because of /tmp/crontab.SJlY0Y/crontab [Permission Denied]crontab -l on the other hand works fine. How can I fix this problem?Here are the current permissions:$ ls -l /tmp/crontab.SJlY0Y/crontab-rw------- 1 root postgres 1.2K Aug  3 11:44 /tmp/crontab.SJlY0Y/crontab$ ls -l /var/spool/crontotal 12Kdrwxrwx--T 2 daemon daemon  4.0K Sep 12  2012 atjobsdrwxrwx--T 2 daemon daemon  4.0K Jun  9  2012 atspooldrwx-wx--T 2 root   crontab 4.0K Aug  3 11:15 crontabs$ ls -l /var/spool/cron/crontabstotal 12K-rw------- 1 git      crontab 1.3K Mar  2 16:48 git-rw------- 1 postgres crontab 1.4K Aug  3 11:15 postgres-rw------- 1 root     root    2.3K Jul 20 20:32 root$ ls -l /usr/bin/crontab-rwsr-xr-x 1 root root 36K Jul  3  2012 /usr/bin/crontab$ ls -ld /tmp/drwxrwxrwt 6 root root 4.0K Aug  3 11:43 /tmp/
Cannot edit crontab as non root user
debian;permissions;cron
$ ls -l /usr/bin/crontab-rwsr-xr-x 1 root root 36K Jul  3  2012 /usr/bin/crontabThe ownership and permission should actually be-rwxr-sr-x 1 root crontab 35880 Jul  3  2012 /usr/bin/crontabSince Debian sarge, crontab is setgid crontab, not setuid root, as requested in bug #18333.This is the cause of your problem: the crontab program expects to run setgid, not setuid, so it creates the temporary file as the user and group it's running as, which are root and the caller's primary group instead of the calling user and the crontab group.Reinstall the cron package:apt-get --reinstall install cron(as root). Check that /var/spool/cron/crontabs has the correct permissions and ownership:drwx-wx--T 2 root crontab 4096 Oct  8  2013 /var/spool/cron/crontabsIn the future, don't mess with permissions of system files.