[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?
crontab -u sysadmin -eas root?crontab -ewould work.crontab -eregardless of which editor you want to use - just specify emacs via the EDITOR or VISUAL environment variable. See for example crontab -e doesnt shows option to select editor - what to do?ls -ld /var/spool/cron/crontabs/say? What is thefs.protected_regularsysctl set to?