tmpfiles: allow prefixing uid/gid/mode with ":" to only apply on creation
authorLennart Poettering <lennart@poettering.net>
Sun, 11 Sep 2022 10:23:23 +0000 (12:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Sep 2022 07:21:34 +0000 (09:21 +0200)
commitcc43328c7f603fe25478aa8d8a7848b175c6941b
tree4ea481142bbf001c4d96e8cd378236a86e0fc7c1
parenta9bc518c08d4d3a111b637e348f5a60e5a50025f
tmpfiles: allow prefixing uid/gid/mode with ":" to only apply on creation

In some cases it is useful to specify the access mode/uid/gid for inodes
we create without also enforcing them on existing inodes. Let's add a
new flag for that: if the uid/gid/mode specificaitons are prefixed with
":", then they only apply to creation, not otherwise.

This is specifically useful for provisioning SSH keys later. Those we'd
like to provision like this:

<snip>
d /root :0700 root root -
d /root/.ssh :0700 root root -
f^ /root/.ssh/authorized_keys - - - - ssh.authorized_keys
</snip>

While /root/ + /root/.ssh/ being owned by root is pretty uncontroversial
the access mode of /root/ and /root/.ssh/ might not be. Hence we should
only have a default mode defined that is used when we create the dir,
but not otherwise.
src/tmpfiles/tmpfiles.c