envgid 1 user commands nosh
envgid add GID environment variable then chain
`envgid` groupname next-prog

## Description

`envgid` is a chain-loading utility that sets the `GID` environment variable to the value for groupname in the system groups database and then chain loads to next-prog with the execvp 3 function.

It unsets the `GIDLIST` environment variable entirely.

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

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

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

## See also

- getuidgid 1

- envuidgid 1

- setuidgid-fromenv 1

## Author

Jonathan de Boyne Pollard