This scratch file was created by apache

-rw-rw-r--+  1 apache apache   1960 Nov 16  2019 zlz7v5y9.php

When executing the following:

-bash-4.2$ rm zlz7v5y9.php

I get:

rm: cannot remove ‘zlz7v5y9.php’: Permission denied

Here are the permissions:

-bash-4.2$ getfacl zlz7v5y9.php
# file: zlz7v5y9.php
# owner: apache
# group: apache
user:tomr:rwx               #effective:rw-
user:subtum:rwx             #effective:rw-
group::rwx                  #effective:rw-

Oddly, I CAN edit the file but cannot delete it.

Why am I getting "Permission denied" when trying to delete this file?

UPDATE: Reissuing the setfacl command for a single user fixed the issue for BOTH users. Apparently the ACL system had died and setfacl woke it up? Even though it is working correctly now, I would like to know how this happened for the future. BTW, this is on a system that has had the same ACL config for years and suddenly it stopped working with no changes.

UPDATE#2: This issue keeps reappearing. I'm wondering if somehow a hacker has gotten in and is causing this. However, I run tripwire and do not see any suspicious system changes.

  • Interesting fix. Never seen that happen before with POSIX File ACLs
    – fpmurphy
    May 25 '20 at 8:19

The File deletion is based on directory perms, not the file perms.

Did you check the directory permission (write)?

Note: You can have a directory where you enforce that only the owner of the file can delete it. This is useful for temp dirs.

Also, please check whether this directory have any "sticky" aka "restricted deletion" mode set (o+t). With this mode set, only the file's owner can move or delete files in that directory, regardless of any perms.

  • Thank you for the reply but please read the "UPDATE" part of the question. This system has been working correctly for years. No changes. The "fix" was to execute setfacl on one of the users and everything works correctly again. No perms were modified. May 24 '20 at 3:21

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.