I want to create a directory, for example:
/public/all
But I want it so that if you create a file in all, the owner is root, but anyone with access to the /public/all folder can delete/edit/etc the file, just not change the permissions. (I will use a self-created "setx" application to change the execute value if needed.)
Reason for this, I don't want you to be able to deny other users write/read access to files in /public/all. I heard setuid on directories doesn't work for that.
Best Answer
You cannot do this; the initial owner is always the object's creator.
What you can do is set the default ACLs to automatically allow read/write to everyone:
Also optionally set a default group:
However, none of these will prevent the owner from changing the permissions later.
An alternative solution is to monitor the directory with inotify (using
incron
) and automatically runchown
on creation. Put this to incrontab: