Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a directory, for example:


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.

share|improve this question
up vote 5 down vote accepted

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:

setfacl -m default:u::rwx,default:g::rwx,default:o::rwx /public/all

Also optionally set a default group:

chown :nobody /public/all
chmod g+s /public/all

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 run chown on creation. Put this to incrontab:

/public/all IN_CREATE chown nobody:nobody $@/$#; chmod 0666 $@/$#
share|improve this answer
The chmod at the end will remove executable flags. This effect might be desired in such a directory (unless it's subdirectories), but I thought I'd mention that. – Daniel Beck Nov 26 '11 at 14:03
Ah, I forgot that. chmod ugo=rwX should work. – grawity Nov 26 '11 at 14:12

Your Answer


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.