Name

envuidgid — add UID and GID environment variables then chain

Synopsis

envuidgid [--supplementary] {account} {next-prog}

Description

envuidgid is a chain-loading utility that sets the UID and GID environment variables to the values for account in the system account database and then chain loads to next-prog with the execvp(3) function.

If the --supplementary option is used, it will also set the GIDLIST environment variable to the (comma-separated) list of supplementary GIDs for the groups to which account belongs, as listed in the groups database. Without that option, it ignores the group database and unsets the GIDLIST environment variable entirely.

If it cannot set the environment variables, or cannot find an account named account in the database, it does not chain and exits with status code 111.

next-prog may contain its own command line options, which envuidgid will ignore.

The main purpose of envuidgid is to eliminate the need for a process that has run chroot(1) to read from the system password database. Instead of running setuidgid(1) and thus forcing the need for a copy of the system password database inside the changed root environment, a chain runs envuidgid and can obtain the account information from the environment (or run setuidgid-fromenv(1)) later.

Author

Jonathan de Boyne Pollard