2

I have a directory called "music" and two groups: music, singers.

I executed

chgrp music music

I am looking to grant read and write access to the /music directory for the singers group, but I don't want to change the ownership.

Is this possible?

I am a bit confused with chown and chgrp. I believe chown changes ownership for a single user and not a group? and chgrp changes the group?

Is there a way to set group ownership, but grant permissions to one other specified group?

4

There is no way to do this using traditional permissions, but it can be done using the getfacl and setfacl commands (typically available via the acl package).

getfacl allows you to read the ACL entries for a directory or file.

setfacl allows changing the ACL entries for a directory or file.

In your example, you would want to run something like the following commands:

setfacl -m g:music:rwx /path/to/music
setfacl -m g:singers:rwx /path/to/music

-m to modify, g to modify the group ACL(s), music and singers the group name, rwx the traditional permissions you want applied, /path/to/music the path to the directory you want to modify ACLs for.

To make this apply by default to any new files/directories created within the music folder, you want to add the -d flag for default, and to apply recursively to all existing files/directories, you want to add the -R flag for recursive.

1

chown changes the user and/or group ownership of each given file. chgrp only changes the group of the files specified. Usually, you can run man <command> (if it has a manual) or <command --help> to see how a command is to be used.

So the command chgrp music music would give the group music ownership of the folder music.

Its not possible for multiple groups to own a file or folder, but there are workarounds:

  • Assuming group music owns the folder, you can use an ACL to define permissions groupsingers.

  • Create a new group which will include all users of groups singers and music and set that make that new group owner of the folder music which is discussed here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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