NEWUIDMAP(1)
๐ NEWUIDMAP โ bestie edition ๐
okay so. newuidmap is the girl whose whole job is setting the uid mapping of a user namespace. that's it. that's the gig. she's giving sysadmin main character energy and honestly? she ate. ๐
โจ SYNOPSIS โจ
newuidmap pid uid loweruid count [uid loweruid count [ ... ]]
๐ธ DESCRIPTION ๐ธ
so like, newuidmap sets /proc/[pid]/uid_map based on its command line arguments and the uids allowed. that's the whole vibe. โจ
and the subuid delegation? that can either be managed via /etc/subuid or through the configured NSS subid module. and bestie, these options are mutually exclusive โ pick a lane, you cannot do both, no cap. ๐ซ
โ ๏ธ and listen โ the root user is not exempted from the requirement for a valid /etc/subuid entry. not even root. not even a little bit. the rules apply to everybody. periodt.
so after the pid argument, newuidmap expects sets of 3 integers:
uidโ the beginning of the range of UIDs inside the user namespace ๐ซงloweruidโ the beginning of the range of UIDs outside the user namespace ๐countโ the length of the ranges (both inside and outside the user namespace, yes both, one number for both) ๐
then newuidmap verifies that the caller is the owner of the process indicated by pid and that for each of the above sets, each of the UIDs in the range [loweruid, loweruid+count) is allowed to the caller according to /etc/subuid โ and only then does it set /proc/[pid]/uid_map. she checks her work first, as she should. ๐
๐จ also important: newuidmap may be used only once for a given process. one shot. one moment. make it count. ๐ญ
okay and here's the lowkey genius part โ instead of an integer process id, the first argument may be specified as fd:N, where the integer N is the file descriptor number for the calling process's opened file descriptor for the directory /proc/[pid]. in this case, newuidmap will use openat(2) to open the uid_map file under that directory, avoiding a TOCTTOU in case the process exits and the pid is immediately reused. iconic. no race condition, no drama, just vibes. ๐ฆ
๐ OPTIONS ๐
there currently are no options to the newuidmap command.
that's it. that's the section. she said "no flags, no extras, we're doing this raw." and honestly? respect. ๐
๐ FILES ๐
/etc/subuidโ list of user's subordinate user IDs. the sacred scroll. ๐/proc/[pid]/uid_mapโ mapping of uids from one between user namespaces. the place where the magic actually gets written. โจ
๐ฅ SEE ALSO ๐ฅ
login.defs(5), newusers(8), subuid(5), useradd(8), usermod(8), userdel(8)
that's the whole page bestie, go forth and map some uids responsibly ๐
sign-off: this was shadow-utils 4.20.0 dated 07/30/2026 โ mwah, love u, bye! ๐๐๐ฆ
๐ฆ where this page comes from
- arch rolling: shadow 4.20.0.arch1-1 ยท 0BSD AND BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms