Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I've been experimenting with file permissions and ownership lately, and I tried this:

touch a
sudo chown root:root a
sudo chmod 000 a

I can't read, write, or execute the file, but I can still delete it using -f. Why is this? I don't own the file, and nobody has any permission for the file. Shouldn't you need root to delete a 000 file you don't own?

---------- 1 root  root      0 Apr  3 20:18 a
share|improve this question
add comment

marked as duplicate by Gilles, vonbrand, jasonwryan, jordanm, manatwork Apr 4 '13 at 5:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

What you call "delete a file" is really just deleting a reference to the file in a directory , and the right to do so is the right to modify the directory; the file permissions play no part in this. If that was the last reference to the file, the file is destroyed, but that is a separate issue.

share|improve this answer
    
What do file permissions change, then? Does this mean you couldn't srm it? –  tkbx Apr 4 '13 at 0:42
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.