1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00
systemd/sysusers.d
Zbigniew Jędrzejewski-Szmek 49bb7fe5f8 sysusers: insist that root group is 0
In https://bugzilla.redhat.com/show_bug.cgi?id=2156900 sysusers was reporting a
conflict between the following lines:
  u root 0:0 "Super User" /root /bin/bash
  u root    0     "Super User" /root

The problem is that those configurations are indeed not equivalent. If group 0
exists with a different name, the first line would just create the user, but the
second line would create a 'root' group with a different GID. The second
behaviour seems definitely wrong. (Or at least more confusing in practice than
the first one. The system is in a strange shape, but the second approach takes
an additional step than is worse than doing nothing.)

When this line was initially added, we didn't have the uid:gid functionality for
'u', so we didn't think about this too much. But now we do, so we should use it.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'g foobar 0'
Creating group 'foobar' with GID 0.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0 "Zuper zuper"'
src/sysusers/sysusers.c:1365: Creating group 'root' with GID 999.
src/sysusers/sysusers.c:1115: Suggested user ID 0 for root already used.
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 999 and GID 999.

vs.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0:0 "Zuper zuper"'
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 0 and GID 0.
2023-02-01 00:02:09 +00:00
..
basic.conf.in sysusers: insist that root group is 0 2023-02-01 00:02:09 +00:00
meson.build meson: also allow setting GIT_VERSION via templates 2022-04-05 22:18:31 +02:00
README Add READMEs in all .d directories 2021-03-26 09:35:07 +01:00
systemd-coredump.conf sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00
systemd-journal.conf.in sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00
systemd-network.conf.in sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00
systemd-oom.conf sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00
systemd-remote.conf meson: minor cleanup 2021-07-11 18:00:28 +02:00
systemd-resolve.conf.in sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00
systemd-timesync.conf.in sysusers: split up systemd.conf 2021-07-11 18:00:25 +02:00

Files in this directory contain configuration for systemd-sysusers, a program
to allocate system users and groups.

See man:sysusers.d(5) for explanation of the configuration file format, and
man:systemd-sysusers(8) for a description of when and how this configuration is
applied.

Use 'systemd-analyze cat-config sysusers.d' to display the effective config.