0

When using a Puppet file resource with recurse=>true is it possible to have directories and files get different permissions?

That is we generally want to remove read/execute permissions from group for all non-directory files. However, directories should retain the execute permission since that is required to enter the directory.

Some utilities (e.g. umask) are intelligent enough to deal with this but it looks like Puppet may not be. Am I missing anything?

0

In fact puppet does this by default:

"When specifying numeric permissions for directories, Puppet sets the search permission wherever the read permission is set."

see also: https://docs.puppet.com/puppet/latest/types/file.html#file-attribute-mode

A more explicit alternative is to use symbolic modes like "ug+X", this will only affect directories and will even allow to make directories searchable/executable without them being readable (which does allow you to enter the directory but then not read its contents... not sure if that is what you want though).

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.