3

This question already has an answer here:

I want to place a file in an FTP users directory (a readme) and make it so they cannot delete it.

I've got /home/user/iso/readme.txt uploaded as root, permissions set to 0444 - (r--r--r--) Yet when I log in as a normal user I can delete it. How can I prevent this?

marked as duplicate by techraf, HalosGhost, don_crissti, sam, Jeff Schaller Oct 10 '16 at 16:19

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.

12

To remove a file you need write access to the directory it is in, to modify the file you need write access to the file. They are two different operations.

So if you wish to stop a user from removing a file, it cannot be in a directory that user owns since ultimately then can always make that directory writable to themselves.

You might be able to do it with more granular tools such as ACLs for SELinux etc

  • 2
    Aha, okay so I placed it inside a directory called 'Please Readme' with 0555 permissions and now it is working correctly. Thanks!! – Chud37 Oct 10 '16 at 13:39

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