B
B
bugaga01123582012-05-16 08:34:50
linux
bugaga0112358, 2012-05-16 08:34:50

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

8 answer(s)
E
Eddy_Em, 2012-05-16
@Eddy_Em

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.

S
sistemshik, 2012-05-16
@sistemshik

You can:
superuser.com/questions/152161/is-it-possible-to-forbid-removal-of-files-but-allow-creation-of-them-for-specifi

V
Vlad Zhivotnev, 2012-05-16
@inkvizitor68sl

Try to read about xattr, most likely there is what you are looking for.

G
Gleb Starkov, 2012-05-16
@colonel

It is forbidden.
Deleting and creating is writing to a directory.
You either have write access or you don't.

@
@sledopit, 2012-05-16
_

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.

E
ertaquo, 2012-05-16
@ertaquo

This can be done using the AFS file system . But how exactly this is done - I do not know.

S
stg34, 2012-05-16
@stg34

And ACL does not rescue in this case?

T
Tthread, 2012-05-16
@Tthread

Look towards RSBAC. There are various models of access control implemented.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question