This series adds support for mapping ranges of user/group IDs using the newuidmap and newgidmap programs from shadow. The intent is to allow for root-less bootstrapping of Linux root filesystems with correct ownership. My primary inspiration is mmdebstrap [1], which uses unshare(2) to create Debian root filesystems without needing root access. [1] https://gitlab.mister-muffin.de/josch/mmdebstrap Changes in v2: - Add "auto" option for --map-users and --map-groups - Add UID_BUFSIZ macro to hold the maximum size of a uid represented as a string - Add some documentation for waitchild - Add some helpers for forking and synchronizing - Copy names from string_to_idarray into a buffer to add a nul-terminator, instead of modifying them directly - Document new "auto" value for --map-user and --map-group - Fix most of read_subid_range using spaces instead of tabs - Fix typo of --group instead of --user - Update doc comments for uint_to_id() and get_map_range() - Use more meaningful numbers in map_ids - Use pathname macros for /etc/sub{u,g}id - Use sync helpers for idmap Sean Anderson (6): include/c: Add abs_diff macro unshare: Add waitchild helper unshare: Add some helpers for forking and synchronizing unshare: Add options to map blocks of user/group IDs unshare: Add option to automatically create user and group maps unshare: Document --map-{groups,users,auto} include/c.h | 8 + include/pathnames.h | 3 + sys-utils/unshare.1.adoc | 32 +++ sys-utils/unshare.c | 477 ++++++++++++++++++++++++++++++++++----- 4 files changed, 465 insertions(+), 55 deletions(-) -- 2.33.0