When a preserved path contains parent directories that do not exist on the volatile volume, Preservation handles them differently based on the scope:
User-specific files
For paths within a user's home directory (up to but not including the home directory itself), intermediate components are created with the respective user as owner and mode 0755.
System-wide files
For system-wide paths, missing intermediate components are created by systemd-tmpfiles with default ownership root:root and mode 0755.
To configure custom ownership or modes for these intermediate directories, use systemd.tmpfiles.settings.preservation instead of relying on Preservation's configureParent option, as the latter can become convoluted for deep directory trees.
# Example: Preserving /foo/bar/baz while configuring parents via tmpfiles
preservation.preserveAt."/persistent".files = [
{ file = "/foo/bar/baz"; user = "foo"; group = "bar"; };
];
systemd.tmpfiles.settings.preservation = {
"/foo".d = { user = "foo"; group = "bar"; mode = "0775"; };
"/foo/bar".d = { user = "bar"; group = "bar"; mode = "0755"; };
};