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