Linux – cannot remove owned file with 777 permissions

To remove one file you need write permission on the directory that contains¹ this file.

Here the permissions are dr-xr-xr-x 3 rayell pg1083760 4096 2010-10-10 10:00 . So nobody (other than root) can remove files inside this directory. The owner must use chmod first.


1. There are pretty good reasons for that. By ‘removing’ a file with rm, you are in fact trying to unlink it from the directory (hardlinked copies will not be deleted).


Another possible question is attribute

lsattr file

This command will show you attribute of the file and a file with 'i' attribute cannot be modified (and be deleted)

so check your file's attribute and remove 'i' attribute if the attribute is been set

chattr -i file