s6: the s6-envuidgid program
Keywords: s6 command s6-envuidgid uid gid environment modification

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 [ -i | -D uid:gid ] account prog...

- s6-envuidgid looks account up by name in the account database.
- 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....

## Options

- `-i` : insist. If account is unknown, exit 1 with an error message. This is the default.
- `-D uid:gid` : if account is unknown, use uid, gid, and the empty list as the values for UID, GID and GIDLIST.

## Notes

- s6-envuidgid without options behaves like envuidgid, except that the exit code is 1 if account doesn't 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.