I want to allow any write access to directory but prevent ANYONE (aside from root?) from deleting the files once they are written. Is there a permissions system that would allow for this?

There is no time to modify permissions between write and delete time.

  • I've been looking into chattr and the "undeletable" attribute... – arcyqwerty Mar 10 '12 at 7:32
  • Was there any solution for this question? I was kind of curious myself. I would like to create a directory that can be written to by anyone but once something is written it can only be deleted by root. Even the user is the owner. No Modify. Is this kind of customization possible on just a standard debian install? Any response would be appreciated. – Justin Yoder Aug 14 '14 at 3:11
  • Immutable +i flag on the file and append +a on the containing directory might point you in the right direction. Don't know how to automatically set it on file create though.... – arcyqwerty Aug 18 '14 at 6:07

Root will always have permissions.

chmod +t file/folder

This sets a sticky bit so only the creator of the file can delete it, no-one else. Outside of that you may need to explore other options, such as making the app/person run the create command as : sudo -u USER vi/touch /dir/file

Also check out the chmod manpage


chattr +a seems to work as it only allows append to the directory (creating files)

Root won't be able to remove it directly but is able to chattr -a when it comes time to delete.

  • This does not work on a mounted file system. – Azizur Rahman Apr 27 '14 at 10:34
  • It depends on your filesystem and whether it has support for these attributes. Should work under ext2/3/4 and perhaps others – arcyqwerty Apr 28 '14 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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