SETRESGID(3) Library Functions Manual SETRESGID(3)

setresgidset real group ID, effective group ID, and saved set-group-ID


#include <unistd.h>

int setresgid(gid_t rgid, gid_t egid, gid_t sgid);

The setresgid () function shall set the real group ID, effective group ID, and saved set-group-ID of the calling process to the values specified by , , and , respectively.

If an argument is -1, the corresponding ID shall not be changed.

Only a process with appropriate privileges can set the real group ID, effective group ID, and saved set-group-ID to any valid value.

A non-privileged process can set its real group ID, effective group ID, and saved set-group-ID, each to one of the values that it currently holds in its real group ID, effective group ID, or saved set-group-ID.

The real group ID, effective group ID, and saved set-group-ID can be set to different values in the same call.

Any supplementary group IDs of the calling process shall remain unchanged.

Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and set to indicate the error, and none of the IDs shall be changed.

The setresgid () function shall fail if:

The value of the rgid , egid , or sgid argument is invalid or out-of-range.
The calling process does not have appropriate privileges and an attempt was made to change the real group ID, effective group ID, or saved set-group-ID to a value that is not currently present in one of those IDs.

None.

None.

None.

None.

exec(3), getegid(3), geteuid(3), getgid(3), getresgid(3), getresuid(3), getuid(3), setegid(3), seteuid(3), setgid(3), setregid(3), setresuid(3), setreuid(3), setuid(3)

XBD <unistd.h>

First released in Issue 8.

June 14, 2024 posix.fail