shadow: create empty /etc/sub{u,g}id files

They are databases for subordinate user and group IDs, which are useful
for rootless containers like podman (well, it's beyond BLFS but maybe
users will install it on BLFS anyway).  If those files exist, useradd,
groupadd, and etc. will automatically manage their contents; otherwise
the user will create them (following the podman doc) and manage their
contents for already created users/groups manually.  Doing so would be
more error-prune than the automatic handling, and also inconsistent (the
new user and groups will have the subordinate IDs automatically, but the
existing user and groups will not).

So for convinence and consistency, create them and let the Shadow
utilities to manage them.
This commit is contained in:
Xi Ruoyao
2026-07-05 02:03:45 +08:00
parent 6a42a0e046
commit 4344f6bdea

View File

@@ -291,6 +291,22 @@ useradd -D --gid 999</userinput></screen>
</variablelist>
<para>
Finally, create the empty <filename>/etc/subuid</filename> and
<filename>/etc/subgid</filename> files:
</para>
<screen><userinput>touch /etc/sub{u,g}id</userinput></screen>
<para>
The content of those files will be automatically updated by some
utilities provided by Shadow to allocate subordinate user and group
IDs. Read the man pages
<ulink role='man' url='&man;subuid.5'>subuid(5)</ulink> and
<ulink role='man' url='&man;subgid.5'>subgid(5)</ulink> for the
details about the subordinate IDs.
</para>
</sect2>
<sect2 role="configuration">