Skip to content

Execute in parent's user namespace#4

Open
fionn wants to merge 1 commit into
amazonlinux:mainfrom
fionn:no-user-ns
Open

Execute in parent's user namespace#4
fionn wants to merge 1 commit into
amazonlinux:mainfrom
fionn:no-user-ns

Conversation

@fionn

@fionn fionn commented Jul 3, 2026

Copy link
Copy Markdown

Setting PrivateUsers=yes runs the service in a user namespace. However, this provides marginal or zero benefit to a process that runs as root that already has capabilities dropped.

If set to a true value or "self", a minimal user and group mapping is configured that maps the "root" user and group as well as the unit's own user and group to themselves

(from systemd.exec (5)).

It also does no harm, but there is a trade-off: this prevents update-motd from running on systems that disable user namespaces (e.g. by setting user.max_user_namespaces to zero). This can be desirable for security reasons, as the ability to create user namespaces has, at least historically, been partially responsible for local privilege escalation bugs.

See: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#PrivateUsers=

Setting PrivateUsers=yes runs the service in a user namespace. However,
this provides marginal or zero benefit to a process that runs as root.

> If set to a true value or "self", a minimal user and group mapping is
> configured that maps the "root" user and group as well as the unit's
> own user and group to themselves

(from systemd.exec (5)).

It also does no harm, but there is a trade-off: this prevents
update-motd from running on systems that disable user namespaces (e.g.
by setting user.max_user_namespaces to zero). This can be desirable for
security reasons, as the ability to create user namespaces has, at least
historically, been partially responsible for local privilege escalation
bugs.

See: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#PrivateUsers=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant