title: How to use a Puppet File Resource to give different permissions on a directory than to it's files?
body: <p>I would like to use Puppet to manage a directory. I want the directory to be owned by user root and group admin, with 0770 permissions.</p>
  
  <p>I would like all files in the directory to be owned by user apache and group admin with 0600 permissions.</p>
  
  <p>I have yet to find a way to achieve this using the file resource in Puppet. I have tried using two resources like so:</p>
  
  <pre><code>file { 'phpsessions_files':
      path =&gt; '/var/phpsessions',
      ensure =&gt; directory,
      owner =&gt; 'apache',
      group =&gt; 'admin',
      mode =&gt; 0600,
      recurse =&gt; true,
      before =&gt; File['phpsessions_dir'],
  }
  
  file { 'phpsessions_dir':
      path =&gt; '/var/phpsessions',
      recurse =&gt; false,
      owner =&gt; 'root',
      group =&gt; 'admin',
      mode =&gt; 0770,
  }
  </code></pre>
  
  <p>But I am not allowed to create two file resources to the same path and I can't see how to achieve what I want with just one resource.</p>
  
  <p>Your help is much appreciated.</p>