Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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 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 at 6:07

2 Answers 2

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

share|improve this answer
up vote 0 down vote accepted

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.

share|improve this answer
    
This does not work on a mounted file system. –  Azizur Apr 27 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 at 3:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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