0

Consider we have two groups: readers and writers. I want to create a file (directory), for which the following holds:

  1. Only users from group 'writers' can have write access to this file.
  2. Only users from 'readers' or 'writers' can read this file.
  3. Other users have no access to file.

If writers has only one member, it can be easily done with 640 mask (owner writer, group readers). But how can this be done for group?

ov7a
  • 113
  • 6

1 Answers1

3

Filesystem must support acl

  1. Check that filesystem mounted with acl option (runing mount for example)
  2. Set acl for writers: setfacl -m g:writers_group:rw /somepath/somefile
  3. Set acl for readers: setfacl -m g:readers_group:r /somepath/somefile
  4. Remove if you need unnecessary access using chmod and setfacl -x
  5. Check acl: getfacl /somepath/somefile

More info for example here.

Slipeer
  • 3,295
  • 2
  • 21
  • 33