1

Is there a way in Linux on a ext4 file system that I can make a file readable and writeable but not deletable?

The directory that the file resides in still needs to be writeable by the owner of the directory.

2
  • What is the use-case? If I can write to a file I can empty it, do you have an application that needs the file to exist even if empty? Commented Aug 22, 2012 at 17:11
  • Kinda spot on. I want to offer a config file for a user that an app will use but it doesn't matter if its empty.
    – Scott
    Commented Aug 22, 2012 at 18:43

1 Answer 1

0

If you make the directory not writable, the file cannot be deleted.

2
  • The directory still needs to be writeable. I will update question to be more clear
    – Scott
    Commented Aug 22, 2012 at 16:06
  • @Brady: Does the directory need to be world-writable? Do you need to prevent the owner of the directory from deleting the file? (This would probably be impossible.) If the answers to both questions are ‘no,’ set the directory mode to 755. Commented Oct 1, 2012 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .