s6
Software
skarnet.org
The s6-envuidgid program
s6-envuidgid sets the UID, GID and GIDLIST environment variables,
then executes into another program.
Interface
s6-envuidgid account prog...
- s6-envuidgid looks account up by name in the account database.
- If account is unknown, it exits 1.
- It sets the UID environment variable to account's uid, and the GID
environment variable to account's gid.
- It also sets the GIDLIST environment variable to a comma-separated list of
supplementary group ids account is a member of according to the
group database. (If account doesn't belong to any other group than its
primary group, GIDLIST is still set, but empty.)
- Then it executes into prog....
Notes
s6-envuidgid behaves like
envuidgid, except that:
- it also handles supplementary groups
- It exits 1 if account does not exist.
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. Superservers such as
s6-tcpserver4
make use of this.