Sample Header Ad - 728x90

Why can't root edit /var/spool/cron/crontabs?

0 votes
0 answers
379 views
[Please, I don't want to know why I *shouldn't* edit it; I want to know why I *can't* edit it] # pwd /var/spool/cron/crontabs # ll sysadmin -rw------- 1 sysadmin crontab 210 Jun 17 16:05 sysadmin # getcap sysadmin # lsattr sysadmin --------------e------- sysadmin # filecap /var/spool/cron/crontabs/sysadmin Unable to get capabilities of /var/spool/cron/crontabs/sysadmin: No data available This is Ubuntu 22.04, ext4, LVM. I can delete the file, but I can't write to it. **EDIT** crontab -e successfully changes the file, as expected. However, editing the file with a text editor (in my case, emacs, while running as root) simply gives an error message ("Opening output file: Permission denied, /var/spool/cron/crontabs/sysadmin"). **EDIT 2** This question isn't about emacs, or any other editor - it appears that crontab -e has some magic which I can't duplicate as a root user, and that the magic is unrelated to file capabilities. If I try echoing to the file as suggested in a comment: root@vserver:/var/spool/cron/crontabs# echo "foo" >> sysadmin bash: sysadmin: Permission denied So what is it that's denying me permission?
Asked by QF0 (391 rep)
Jun 17, 2024, 03:25 PM
Last activity: Jun 18, 2024, 02:31 PM