setuidgid-fromenv — set process UID and GID(s) then chain


setuidgid-fromenv {next-prog}


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.

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


Jonathan de Boyne Pollard