S6-ENVUIDGID(8)

πŸ“¦ version 2.15.1.0, in nixpkgs unstable

πŸ’– S6-ENVUIDGID πŸ’–

okay so bestie, welcome to s6-envuidgid(8), aka the System Manager's Manual page you're about to absolutely devour. she's a little tool that maybe sets the UID, GID and GIDLIST environment variables based on whatever options and arguments you hand her, and then she executes into another program. slay.


✨ NAME ✨

s6-envuidgid β€” potentially set the UID, GID and GIDLIST environment variables according to the options and arguments it is given, then execute into another program 🫢


🌸 SYNOPSIS 🌸

s6-envuidgid [-u | -g | -B] [-n] [-i | -D uid:gid:gidlist] account
             prog...

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: s6-envuidgid looks account up by name in the account database. iconic behavior honestly.

it sets the UID environment variable to account's uid, and the GID environment variable to account's gid. yes bestie, both.

it also sets the GIDLIST environment variable to a comma-separated list of supplementary group ids that account is a member of, according to the group database. and listen β€” if account doesn't belong to any other group than its primary group, GIDLIST is still set, it's just empty. she shows up either way, periodt. πŸ’…

then it executes into prog.... that's the whole arc.

s6-envuidgid without options behaves like envuidgid[1], except that the exit code is 1 if account doesn't exist, and it also exports supplementary groups. two little upgrades, no cap.

s6-envuidgid is useful when running a program that must start as root but can drop its privileges later. such a program can read its new uid/gid/groups info from the UID, GID and GIDLIST environment variables. super-servers such as s6-tcpserver(8) make use of this. main character energy fr fr πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

  • -u β€” User. account will be interpreted as a user name; the UID environment variable will be set to its numerical value, and the GID and GIDLIST variables will not be touched. hands off, she's just doing user stuff πŸ’œ
  • -g β€” Group. account will be interpreted as a group name instead of a user name; the GID environment variable will be set to its numerical value, and the UID and GIDLIST variables will not be touched.
  • -B β€” Both user and group. account will be interpreted as 'user:group'. the GIDLIST variable will not be touched. if user does not exist, the UID variable will be set to 0 unless a better default is provided with the -D option. if group does not exist, the GID variable will be set to 0 unless a better default is provided with the -D option. defaults, but make them cute ✨
  • -n β€” Numerical fallback. if account cannot be found in the user or group database, try to interpret the given values literally. for instance, s6-envuidgid -B root:42 will fail if there's no group named '42' in the group database, but s6-envuidgid -nB root:42 will set UID to 0 and GID to 42. literally the save of the century 😭
  • -i β€” Insist. if account is unknown, exit 1 with an error message. this is the default. she's stubborn and that's valid πŸ’€
  • -D uid:gid:gidlist β€” if account is unknown, use uid, gid and gidlist as the values for UID, GID and GIDLIST. your custom defaults, your rules πŸ“

🌈 SEE ALSO 🌈

s6-applyuidgid(8), s6-envdir(8), s6-fghack(8), s6-setsid(8), s6-setuidgid(8), s6-softlimit(8), s6-tai64n(8), s6-tai64nlocal(8), s6-tcpserver(8)

[1] https://cr.yp.to/daemontools/envuidgid.html

this man page is ported from the authoritative documentation at: https://skarnet.org/software/s6/s6-envuidgid.html


πŸ‘‘ AUTHORS πŸ‘‘

Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)


and that's the whole page, bestie, you ate πŸ’– the source is Debian, dated April 16, 2024 β€” S6-ENVUIDGID(8) β€” go forth and drop those privileges responsibly πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from