2

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.

3
  • I've been looking into chattr and the "undeletable" attribute...
    – arcyqwerty
    Mar 10, 2012 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. Aug 14, 2014 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, 2014 at 6:07

2 Answers 2

1

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

0

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.

2
  • This does not work on a mounted file system. Apr 27, 2014 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, 2014 at 3:57

You must log in to answer this question.

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