File attributes on Android (Linux): Any way to make a file fully writable but not deleteable?



  • I tried chattr with the +a (+i is even more restrictive), but it immediately caused app panic aka "app has stopped". What I want to do is make a file & folder undeletable.

    You can perform any kind of rw function (add a.k.a. append, delete some data inside, update) but rm file/folder (file deletion) is not allowed until that attribute is reset so that the app continues to run as normal.

    Is that possible or asking for too much? Pardon my lack of surf searching. I'd imagine this to be in the wish list of many so it won't harm framing this languishing wish as a question.



  • You don't need to use any fancy ACLs or attributes for this. Just make the file writable and the directory that it's in read-only. This works because deleting a file only checks for write permission on the parent directory, and completely ignores permissions on the file itself.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2