envuidgid 1 user commands nosh
envuidgid set UID, GID, and GIDLIST environment variables then chain
`envuidgid` --primary-group group --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.

`envuidgid` intentionally does not set the `LOGNAME` environment variable. It does not deal in login sessions, and is not altering the "login name".

If the --primary-group option is used, `envuidgid` will use group instead of the primary GID of account as the `GID` value.

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 account 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.

## See also

- envgid 1

- setgid-fromenv 1

## Author

Jonathan de Boyne Pollard