I can't run crontab -e as a regular user on a gentoo box I've got. Here's a transcript:

ben@tools ~ $ crontab -e
    # (I add something trivial, like a new line containing "#foo")
crontab: installing new crontab
chown: Operation not permitted
crontab: edits left in /tmp/crontab.XXXXULPy6M
ben@tools ~ $

I have another gentoo machine on which it works fine.

I've checked permissions on all these things, and they all look both sensible and identical to the machine where it works:

tools ~ # ls -AFlh /usr/bin/crontab 
-rwxr-s--x 1 root crontab 29K Oct 22 16:16 /usr/bin/crontab*
tools ~ # ls -AFlhd /tmp
drwxrwxrwt 17 root root 3.2K Oct 22 16:34 /tmp/
tools ~ # ls -AFlhd /var/spool/cron
drwxr-xr-x 4 cron root 4.0K Oct 22 16:07 /var/spool/cron/
tools ~ # ls -AFlhd /var/spool/cron/crontabs
drwx-wx--T 2 root crontab 4.0K Oct 22 16:16 /var/spool/cron/crontabs/

I am a member of the groups cron and crontab:

ben@tools ~ $ groups ben
cron crontab sysops

there is no /etc/cron.allow, and /etc/cron.deny is blank apart from comment lines.

I've tried updating the vixie-cron package, by doing:

emerge --sync
emerge -v vixie-cron # reinstall the current version, in case something is wrong
# add "sys-process/vixie-cron ~x86" to /etc/portage/package.keywords
emerge -v =vixie-cron-4.1-r11

No good.

I've tried running strace against it (both as myself with strace -Ff crontab -e and as root by running crontab -e as myself and then strace -FF -p foo as root), but I can't see anything more useful than the error message I've already got:

chown32("crontabs/tmp.XXXXI5Oi61", 0, -1) = -1 EPERM (Operation not permitted)
write(2, "chown: Operation not permitted\n", 31) = 31
close(4)                                = 0

I have of course googled for it, and every google result has talked about checking permissions on the same files/folders I've checked above.

Help! I'm out of ideas.

  • Ben

Why "drwx-wx--T 2 root crontab 4.0K Oct 22 16:16 /var/spool/cron/crontabs/" this does not have a read permission for the groups?

Either assign the read permission for this crontabs/ directory. I guess the crontab is run as ben:crontab and crontab/ does not have permission for any groups to read from crontabs/

or try 'chmod 4755 /usr/bin/crontab'. With this crontab should be run as root:crontab and crontabs/ has read/write access to root.

  • chmod 4755 /usr/bin/crontab worked. Previous permissions were "-rwxr-s--x", new are "-rwsr-xr-x". – Ben Williams Nov 16 '10 at 5:28
  • chmod g+r /var/spool/cron/crontabs had no effect, btw. – Ben Williams Nov 16 '10 at 5:36

Maybe the crontab rights are changed. On my Ubuntu , it is :

-rwxr-sr-x 1 root crontab 35896 24-08-2010 22:45:58 /usr/bin/crontab

Check the g+s ?

  • My /usr/bin/crontab has g+s (I ls that file above). – Ben Williams Oct 22 '10 at 8:11
  • Your filesysteme is not full or read-only ? – Dom Oct 22 '10 at 13:56
  • Or check if a filesystem is mounted with nosuid option. After check 'lsattr /usr/bin/crontab'. Mine is '-----------------e- /usr/bin/crontab' – Dom Oct 22 '10 at 15:44
  • @Dom: Filesystems (both / and /tmp) were not full. When I get to work on Monday I'll do the relevant lsattrs. – Ben Williams Oct 23 '10 at 8:31
  • root@tools ~ # lsattr -d /tmp lsattr: Inappropriate ioctl for device While reading flags on /tmp root@tools ~ # mount | grep /tmp none on /tmp type tmpfs (size=16m,mode=1777) root@tools ~ # lsattr -d /var/spool/cron -------------- /var/spool/cron root@tools ~ # lsattr -d /var/spool/cron/crontabs -------------- /var/spool/cron/crontabs root@tools ~ # lsattr /usr/bin/crontab -------------- /usr/bin/crontab – Ben Williams Oct 24 '10 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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