systemd/sysusers.d/basic.conf.in
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

41 lines
1.5 KiB
Plaintext

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# The superuser
u root 0:0 "Super User" /root
# The nobody user/group for NFS file systems
g {{NOBODY_GROUP_NAME}} 65534 - -
u {{NOBODY_USER_NAME }} 65534:65534 "Kernel Overflow User" -
# Administrator group: can *see* more than normal users
g adm {{ADM_GID }} - -
# Administrator group: can *do* more than normal users
g wheel {{WHEEL_GID }} - -
# Access to shared database of users on the system
g utmp {{UTMP_GID }} - -
# Physical and virtual hardware access groups
g audio {{AUDIO_GID }} - -
g cdrom {{CDROM_GID }} - -
g dialout {{DIALOUT_GID}} - -
g disk {{DISK_GID }} - -
g input {{INPUT_GID }} - -
g kmem {{KMEM_GID }} - -
g kvm {{KVM_GID }} - -
g lp {{LP_GID }} - -
g render {{RENDER_GID }} - -
g sgx {{SGX_GID }} - -
g tape {{TAPE_GID }} - -
g tty {{TTY_GID }} - -
g video {{VIDEO_GID }} - -
# Default group for normal users
g users {{USERS_GID }} - -