path-attributes

Example:

# Set group/user/mode attributes on an (existing) file.
- path-attributes:
    path: /tmp/freckles.sh
    owner: freckles
    group: freckles
    mode: '0775'

Description

Make sure a file/folder has a certain owner/group.

This will recursively apply the owner/group change in case the path is a directory. If the path does not exist, an empty file will be created.

Root/sudo permissions will be used to do the chown.

If the owner/group does not exist on the machine, this will create them before changing the target ownership.

Variables

Name Type Default Description

mode

string --

The mode to apply. Required

group

string --

the group of the file/folder

owner

string --

the owner of the file/folder

path

string --

the path in question

recursive

boolean False

Whether to apply the changes recursively (if folder).

system_user

boolean --

Whether the user and group should be of system user/group type.

Examples

Example 1

Set group/user/mode attributes on an (existing) file.

Code
- path-attributes:
    path: /tmp/freckles.sh
    owner: freckles
    group: freckles
    mode: '0775'

Command-line

frecklecute path-attributes --help

Usage: frecklecute path-attributes [OPTIONS]

  Make sure a file/folder has a certain owner/group.

  This will recursively apply the owner/group change in case the path is a
  directory. If the path does not exist, an empty file will be created.

  Root/sudo permissions will be used to do the chown.

  If the owner/group does not exist on the machine, this will create them
  before changing the target ownership.

Options:
  --mode MODE                     The mode to apply.  [required]
  --group GROUP                   the group of the file/folder
  --owner USER                    the owner of the file/folder
  --path PATH                     the path in question
  --recursive / --no-recursive    Whether to apply the changes recursively (if
                                  folder).
  --system-user / --no-system-user
                                  Whether the user and group should be of
                                  system user/group type.
  --help                          Show this message and exit.