Server Fault is a question and answer site for system and network administrators. 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 need to set the permissions of a dir so that a usergroup in my ubuntu-server has read/write permissions. I understand that I'm supposed to use chmod (right?), but how do I set the permissions to only apply to a single usergroup?

share|improve this question

closed as off topic by Scott Pack, Iain, mailq, voretaq7, MDMarra Feb 5 '12 at 15:00

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 1 down vote accepted
chown g=$PERMS

Where $DIRNAME is the directory you want to change, $GROUPNAME is the name of the group you want the directory to be owned by, and $PERMS is the combination of rwx that you want to change permissions to.

share|improve this answer
what is "g" in the second row? – AlexanderNajafi Dec 27 '11 at 16:52
@mr.axelander: Group. That only modifies the group level permissions, leaving the user and world permissions unchanged. – Scott Pack Dec 27 '11 at 16:56
sry, but i dont understand. Say i want to change the permissions for the dir x to 777 for the group y. What would i then write ? – AlexanderNajafi Dec 27 '11 at 17:02
@mr.axelander: You don't. When dealing with permissions in octal, 7 indicates "read/write/execute". Then using 777 what you're saying is, "Give read/write/execute permissions to the user-owner/group-owner/everyone on the file." While technically using '777' will give the group rwx permissions, it also gives everyone rwx rights. – Scott Pack Dec 27 '11 at 17:10
@mr.axelander I think you have not understood permisions fully. 777 means all persimisions to all. in this first 7 is for owner of the file. 2nd 7 is for group which file owner is a member of other and thrid 7 is for all others. If you want to change permission for a single group , make the dir part of that group and do chmod g+rw <dir> and make sure you have permission to do so in that dir. – Naai Sekar Dec 27 '11 at 17:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.