]> git.ipfire.org Git - thirdparty/util-linux.git/commit
unshare: Set uid and gid maps directly when run as root
authorChris Webb <chris@arachsys.com>
Thu, 23 Nov 2023 13:14:58 +0000 (13:14 +0000)
committerChris Webb <chris@arachsys.com>
Wed, 29 Nov 2023 21:22:00 +0000 (21:22 +0000)
commitcf22a0c56888aa902cd353c9f05d75f9c4d71245
treef703dae3d5d0ae67d72c65bd71a50c2ffff81e44
parenta212f1fc8319efa19e55686f31deb65372343a01
unshare: Set uid and gid maps directly when run as root

The newuidmap and newgidmap setuid helpers provided by shadow don't allow
root to set up arbitrary mappings without explicit wildcard configuration
in /etc/subuid and /etc/subgid, and are an unnecessary dependency when
unshare is run privileged.

ID-mapped mount already knows how to create uid/gid maps directly for new
user namespaces, so teach unshare to do the same thing when run as root.
Continue to use the setuid helpers when we are not sufficiently privileged
to do the job ourselves.

Signed-off-by: Chris Webb <chris@arachsys.com>
sys-utils/unshare.1.adoc
sys-utils/unshare.c