Different modes for directory, contents?

35 views
Skip to first unread message

Bret Wortman

unread,
Apr 16, 2014, 8:06:53 AM4/16/14
to puppet...@googlegroups.com
Is there a simple way to enforce a different mode for a directory and its contents when the contents of the directory are highly variable? What I mean is that I've got a case where some developers want a directory "/var/log/httpd" to be protected 755 but the contents they want at 644. Is there a simple, Puppet-ish way to make this happen, or are we basically stuck with:

file { '/var/log/httpd':
    ensure => directory,
    mode => '0644',
    recurse => true,
}

It appears the default is to write the files at 644 and the directory at 700, so maybe all I need to do is bump the directory to 755 to make them happy, but there's no way to monitor both ends of this that I can see.


Bret

jcbollinger

unread,
Apr 17, 2014, 9:17:06 AM4/17/14
to puppet...@googlegroups.com


On Wednesday, April 16, 2014 7:06:53 AM UTC-5, Bret Wortman wrote:
Is there a simple way to enforce a different mode for a directory and its contents when the contents of the directory are highly variable? What I mean is that I've got a case where some developers want a directory "/var/log/httpd" to be protected 755 but the contents they want at 644. Is there a simple, Puppet-ish way to make this happen, or are we basically stuck with:

file { '/var/log/httpd':
    ensure => directory,
    mode => '0644',
    recurse => true,
}



I'm missing something.  That declaration ought to do exactly what you say you want (Puppet will add add search permission to directories wherever there is read permission; see http://docs.puppetlabs.com/references/3.4.stable/type.html#file-attribute-mode).  Where do you imagine simplifying it or making it more "puppet-ish"?


John

Bret Wortman

unread,
Apr 17, 2014, 10:33:11 AM4/17/14
to puppet...@googlegroups.com
Doesn't this also make the directory itself 644 instead of 755? Maybe I need to play around with it a bit more.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/YvyV72vReyc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/90f5de75-6672-41a4-81b0-e95eab6354ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jcbollinger

unread,
Apr 18, 2014, 9:39:39 AM4/18/14
to puppet...@googlegroups.com


On Thursday, April 17, 2014 9:33:11 AM UTC-5, Bret Wortman wrote:
Doesn't this also make the directory itself 644 instead of 755? Maybe I need to play around with it a bit more.



No, it doesn't.  I repeat: Puppet will add add search permission to directories wherever there is read permission.  My previous response contained a link to the relevant documentation.


John

Bret Wortman

unread,
Apr 18, 2014, 9:46:07 AM4/18/14
to puppet...@googlegroups.com
Yep, I saw it this time. I was scanning too quickly the last few times I read that page. Sorry, John. I saw and followed the link, but missed the relevant bit of doco.

Thanks again!

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/YvyV72vReyc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages