From 4344f6bdeac83fd8fccb686d48ad6ecf8acf4f9c Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Jul 2026 02:03:45 +0800 Subject: [PATCH] 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. --- chapter08/shadow.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/chapter08/shadow.xml b/chapter08/shadow.xml index 7104b2759..6364354d3 100644 --- a/chapter08/shadow.xml +++ b/chapter08/shadow.xml @@ -291,6 +291,22 @@ useradd -D --gid 999 + + Finally, create the empty /etc/subuid and + /etc/subgid files: + + + touch /etc/sub{u,g}id + + + 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 + subuid(5) and + subgid(5) for the + details about the subordinate IDs. + +