Skip to main content
SaltStack Support

Setting the owner of a directory and file

To set directory and file ownership in a state file you can use the 'file' module in the state file. 

Here is an example of setting directory and files ownership recursively. This SLS file will set the owner on the wiki directory and all of the sub-directories and files: 

/var/www/html/wiki/:
  file.directory:
    - user: apache
    - group: apache
    - recurse:
      - user
      - group

For more information visit: http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#module-salt.states.file

  • Was this article helpful?