setrgid(3) [osf1 man page]
setrgid(3) Library Functions Manual setrgid(3) NAME
setrgid, setegid - Set the process's group IDs LIBRARY
Standard C Library (libc.a) SYNOPSIS
#include <sys/types.h> int setrgid( gid_t rgid); int setegid ( gid_t egid); PARAMETERS
Specifies the value of the real group ID to be set. Specifies the value of the effective group ID to be set. DESCRIPTION
The setegid() function sets the process's effective group ID to the value of the egid parameter if the egid parameter is equal to the cur- rent real, effective, or saved group ID. The setrgid() function sets the process's real group ID to the value of the rgid parameter. Only the superuser may change the real or effective group ID to a value other than the current real or saved group ID of the process. RETURN VALUES
Upon successful completion, the setegid() and setrgid() functions return a value of 0 (zero). If either function fails, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the setrgid() or setegid() function fails, errno is set to one of the following values: The rgid or egid parameter is not equal to either the real or saved group IDs of the process and the calling process does not have superuser privilege. RELATED INFORMATION
Functions: getgroups(2), setgroups(2), setregid(2). Commands: groups(1). delim off setrgid(3)
Check Out this Related Man Page
setuid(3) Library Functions Manual setuid(3) Name setuid, seteuid, setruid, setgid, setegid, setrgid - set user and group ID Syntax #include <sys/types.h> #include <unistd.h> setuid(uid) uid_t uid; seteuid(euid) uid_t euid; setruid(ruid) uid_t ruid; setgid(gid) gid_t gid; setegid(egid) gid_t egid; setrgid(rgid) gid_t rgid; Description The subroutine sets both the real and effective user ID of the current process to the ID specified. Likewise, the subroutine sets the real and effective group ID of the current process to the ID specified. The subroutine sets the effective user ID of the current process, while the subroutine sets the effective group ID of the current process. The subroutine sets the real user ID of the current process, while the subroutine sets the real group ID of the current process. These calls are only permitted to the super-user or if the argument is the real or effective ID. Environment POSIX SYSTEM_FIVE When your program is compiled in POSIX or System V mode the following semantics apply when using the or functions: If the process is the super-user the real, effective, and saved set (as described in user/group ID are set to uid. If the process is not the super-user, but uid is equal to the real or the saved set user/group ID, the effective user/group ID is set to uid. The real and saved set user/group ID remain unchanged. POSIX In POSIX mode, the function returns a value of type uid_t. The function returns a value of type gid_t. Return Values Zero is returned if the user ID or group ID is set; -1 is returned otherwise. See Also setreuid(2), setregid(2), getuid(2), getgid(2) setuid(3)