Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 set a folder such that anything created within it (directories, files) inherit default permissions and group.

Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.

share|improve this question
Isn't that controlled by the user creating the new file/folder, and his umask? – Wadih M. Aug 27 '10 at 15:02
umask does relate to permissions but I do not believe it does anything with setting a default group that is not the user him/herself. – Chris Aug 27 '10 at 15:31
What OS? Tags needed. setfacl and default ACLs don't exist on AIX. – Amit Naidu Apr 25 '13 at 4:50
up vote 112 down vote accepted

I found it: Applying default permissions

From the article:

chmod g+s <directory>  //set gid 
setfacl -d -m g::rwx /<directory>  //set group to rwx default 
setfacl -d -m o::rx /<directory>   //set other

Next we can verify:

getfacl /<directory>


# file: ../<directory>/
# owner: <user>
# group: media
# flags: -s-
share|improve this answer
"Finding" the answer and answering your own question 97 seconds after you asked it makes it seem somewhat like you already had the answer at the start. You're completely allowed to post questions you already know the answer to, if you think other people will have similar problems (and this is definitely a good question to have on the site), although it's usually considered polite to give other people a chance to answer if you already knew the answer going in – Michael Mrozek Aug 27 '10 at 16:15
I see your point, but in this case I just did some looking around after posting assuming an answer would be posted by the time I came back. Sure enough I found a great forum post summing it up in a nutshell so I thought I would save everyone the trouble. Sorry for the problem. – Chris Aug 27 '10 at 17:21
No problem, you're apparently just really fast at searching :). Good question either way – Michael Mrozek Aug 27 '10 at 18:06
Lets not confuse gid with sticky bit. – Amit Naidu Apr 25 '13 at 4:51
g+s will ensure that new content in the directory will inherit the group ownership. setfacl only changes the chmod, in your case sets the permission to o=rx – Time Sheep Feb 12 '14 at 12:28

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.