Search code examples
linuxpermissionspuppetacl

Creating a directory with multiple groups ownership using Puppet?


How do I create a directory with multiple groups owning it using Puppet?

I would like to have users in 'group1' and 'group2' to all have access to the directory.

I tried the code below and it only grants ownership to group1.

file { [ "some/path1", "some/path2" ]:
  ensure => directory,
  owner  => 'root',
  group  => ['group1', 'group2'],
  mode   => 0770,
}

Solution

  • As far as I know, the basic file type in Puppet only handles discretionary permissions that only allow for one group and one owner. It is a limitation of the underlying system.

    Depending on your client's platform you can use ACLs to grant varied permissions to more than one group or user. To do this in Puppet you would have to use an Exec and invoke setfacl (if you were on Linux, for example) directly.