[systemd-devel] Move processes into cgroups based on UID

Lennart Poettering lennart at poettering.net
Thu Oct 1 13:19:48 UTC 2020


On Do, 01.10.20 14:04, azurit at pobox.sk (azurit at pobox.sk) wrote:

> Hi,
>
> i'm trying to use systemd to moving all newely created processes into
> various cgroups based on UID - i think the user slices is the solution. But
> i'm failing.
>
> My very first question: Is systemd able to do this? I want from systemd to
> act similar to cgrulesengd tool ( https://linux.die.net/man/8/cgrulesengd )
> i.e. everytime a process is created or changes UID, it will be moved to
> cgroup(s) accociated with that UID. No matter if the process was a login
> into SSH, cron job or PHP FPM child.

We do not support that for arbitrary UIDs, i.e. not for system UIDs,
the users that system services run under. System services get their
own, individual cgroups anyway though.

For regular login user UIDs we support that and do that by default:
each login user gets their own slice /user.slice/user-$UID.slice/ and
then below that further cgroups for the sessions of the user, and the
user services and so on.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list