chiark / gitweb /
core: add a concept of "dynamic" user ids, that are allocated as long as a service...
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Jul 2016 10:37:28 +0000 (12:37 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:49 +0000 (08:50 +0200)
commitc1d93f2a0a009a95440778c53d89aa693bc6787e
treee1841f2dc52ab6f84ed2f8ef88b15e2f9aaecea4
parent599f015c68718f04ee1946fc263aad8aaa614072
core: add a concept of "dynamic" user ids, that are allocated as long as a service is running

This adds a new boolean setting DynamicUser= to service files. If set, a new
user will be allocated dynamically when the unit is started, and released when
it is stopped. The user ID is allocated from the range 61184..65519. The user
will not be added to /etc/passwd (but an NSS module to be added later should
make it show up in getent passwd).

For now, care should be taken that the service writes no files to disk, since
this might result in files owned by UIDs that might get assigned dynamically to
a different service later on. Later patches will tighten sandboxing in order to
ensure that this cannot happen, except for a few selected directories.

A simple way to test this is:

        elogind-run -p DynamicUser=1 /bin/sleep 99999
src/basic/socket-util.c
src/basic/socket-util.h
src/libelogind/sd-bus/bus-common-errors.c