Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

up vote 49 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>

Output:

# file: ../<directory>/
# owner: <user>
# group: media
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
share|improve this answer
2  
Yay for the sticky bit! –  gabe. Aug 27 '10 at 15:11
8  
"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
7  
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
2  
No problem, you're apparently just really fast at searching :). Good question either way –  Michael Mrozek Aug 27 '10 at 18:06
2  
Lets not confuse gid with sticky bit. –  Amit Naidu Apr 25 '13 at 4:51

Your Answer

 
discard

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.