-1

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?

1 Answer 1

1
chgrp $GROUPNAME $DIRNAME
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.

6
  • what is "g" in the second row? Dec 27, 2011 at 16:52
  • @mr.axelander: Group. That only modifies the group level permissions, leaving the user and world permissions unchanged.
    – Scott Pack
    Dec 27, 2011 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 ? Dec 27, 2011 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, 2011 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.
    – bagavadhar
    Dec 27, 2011 at 17:16

Not the answer you're looking for? Browse other questions tagged .