[systemd-devel] Best practice for prepopulating the CacheDirectory of dynamic users

Lennart Poettering lennart at poettering.net
Thu Mar 1 10:03:16 UTC 2018


On Do, 01.03.18 01:32, Antoine Pietri (antoine.pietri1 at gmail.com) wrote:

> On Wed, Feb 28, 2018 at 6:59 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > Not sure I follow. Why do you let the service hang around? If all you
> > want to do is have it create the directory for you you could just run:
> >
> > # systemd-run -P -p DynamicUser=yes -p CacheDirectory=mywrapper --wait true
> >
> > That would be synchronous, would set up the dir and immediately
> > return.
> 
> My bad, for some reason my understanding was that there was some
> teardown happening after the service was run, but the problem was just
> somewhere else.

There's a destruction logic in place for RuntimeDirectory= but not for
CacheDirectory=. And even for RuntimeDirectory= you can turn it off
with RuntimeDirectoryPreserve=.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list