You can not delete a file from a directory where you don't have write permission - assuming a normal unix-like file system..
The important idea is that there are 3 things which are needed for a file
- The data blocks which hold the actual contents of the file
- The meta-data which holds the information about the file, such as the owner, the modification date, the permissions, and how to find the data blocks.
- The name of the file and how to find the meta-data.
Unix allows you to have more than one name for the same file.
A directory is pretty much just a list of pairs of
(file name component, pointer to meta-data). When you "delete" a file all you are doing is removing the pair from the directory with the correct final component. When all the names of a file have been removed then the data blocks are available for reuse.
From this it is clear that to "delete" a file you need to be able to alter the directory. This needs write permission to the directory.
Note that to remove a file, or to add an additional name to a file does not require any permissions on the file, this are just operations on directories.
The meta-data is stored in things called
i-nodes. The "pointer to meta-data" stored in the directory is actually the index number of an array of
i-nodes stored on the disk. Usually these days the array is stored in a series of blocks split across the disk. You can use
df -i to see how many entries are in use and the total number available.