path-is-owned-by

Example:

# Set group and user attributes on an (existing) file.
- path-is-owned-by:
    path: /tmp/freckles.sh
    owner: freckles
    group: freckles

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

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 and user attributes on an (existing) file.

Code
- path-is-owned-by:
    path: /tmp/freckles.sh
    owner: freckles
    group: freckles
Description

If the file /tmp/freckles.sh exists, this sets its group and owner to 'freckles'. If the file doesn't exist, nothing will be done.

Command-line

frecklecute path-is-owned-by --help

Usage: frecklecute path-is-owned-by [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:
  --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.