setuidgid-fromenv 1 user commands nosh
setuidgid-fromenv set process UID and GID(s) then chain
`setuidgid-fromenv` next-prog

## Description

`setuidgid-fromenv` is a chain-loading utility that sets the process real+effective UID, real+effective GID, and supplementary GID list; and then chain loads to next-prog with the execvp 3 function.

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

The real+effective UID and real+effective GID are set to the values given in the `UID` and `GID` environment variables. If the `GIDLIST` environment variable exists, it is taken to be a list of GIDs which `setuidgid-fromenv` sets as the process list of supplementary GIDs. Otherwise, if it does not exist, the supplementary GIDs list is set to just the primary GID.

One can set up these environment variables with the envuidgid 1 or getuidgid 1 commands.

If it fails setting the group or user IDs, it does not chain and exits with status code 111.

## See also

- envgid 1

- setgid-fromenv 1

## Author

Jonathan de Boyne Pollard