Crontab -e on gentoo failing: “chown: Operation not permitted”

crongentoo

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

Best Answer

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.

Related Topic