Answer the question
In order to leave comments, you need to log in
Linux: Permission to delete files, but not to create
Good day to all.
Is it possible to set up such differentiation of rights for the directory in Linux:
- the user can delete files from the directory;
- the user cannot create new files in the directory.
How the process looks like:
1. The user creates files in the directory.
2. The administrator is a shaman.
3. The user can delete old files but cannot create new ones.
I'm struggling with the sticky bit, but so far either I can delete/create, or I can't delete/create.
Thanks in advance.
UPD
The task, one might say, is sports. It's just that you can do this in Windows, it became interesting whether it is possible with Linux, but so far I could not =)
Answer the question
In order to leave comments, you need to log in
Place this directory on a separate partition. Run a simple daemon that will fill all the freed space in this directory (stick a t-bit on the directory, assign the file the owner of the root).
All. The problem is solved: when a user deletes a file, the space will immediately be full, he will not be able to create a new file.
And of course, there are no non-bicycle ways.
You can:
superuser.com/questions/152161/is-it-possible-to-forbid-removal-of-files-but-allow-creation-of-them-for-specifi
Try to read about xattr, most likely there is what you are looking for.
It is forbidden.
Deleting and creating is writing to a directory.
You either have write access or you don't.
File creation/deletion operations require write access to the directory where the files are located. It is impossible to set rights depending on the type of operation being performed, emnip. Bit sticks are also not helpers here, because. prohibition to change the directory will result in the impossibility of deleting files.
You can pile some crutches, in the spirit of using different users for reading / deleting (although users with the right to delete will still have the right to create), or use different crutches in the spirit of deletion aliases (which, they say, deletion = “chmod + w dir; rm dir/file; chmod -w dir").
It seems to me that there are no other ways.
This can be done using the AFS file system . But how exactly this is done - I do not know.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question