1SETGID(3P)                 POSIX Programmer's Manual                SETGID(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       setgid — set-group-ID
13

SYNOPSIS

15       #include <unistd.h>
16
17       int setgid(gid_t gid);
18

DESCRIPTION

20       If the process has appropriate privileges, setgid() shall set the  real
21       group ID, effective group ID, and the saved set-group-ID of the calling
22       process to gid.
23
24       If the process does not have appropriate privileges, but gid  is  equal
25       to  the real group ID or the saved set-group-ID, setgid() shall set the
26       effective group ID to gid; the real group  ID  and  saved  set-group-ID
27       shall remain unchanged.
28
29       The  setgid() function shall not affect the supplementary group list in
30       any way.
31
32       Any supplementary  group  IDs  of  the  calling  process  shall  remain
33       unchanged.
34

RETURN VALUE

36       Upon  successful  completion,  0  is  returned.  Otherwise, -1 shall be
37       returned and errno set to indicate the error.
38

ERRORS

40       The setgid() function shall fail if:
41
42       EINVAL The value of the gid argument is invalid and is not supported by
43              the implementation.
44
45       EPERM  The  process  does  not have appropriate privileges and gid does
46              not match the real group ID or the saved set-group-ID.
47
48       The following sections are informative.
49

EXAMPLES

51       None.
52

APPLICATION USAGE

54       None.
55

RATIONALE

57       Refer to the RATIONALE section in setuid().
58

FUTURE DIRECTIONS

60       None.
61

SEE ALSO

63       exec, getegid(), geteuid(), getgid(), getuid(),  setegid(),  seteuid(),
64       setregid(), setreuid(), setuid()
65
66       The Base Definitions volume of POSIX.1‐2017, <sys_types.h>, <unistd.h>
67
69       Portions  of  this text are reprinted and reproduced in electronic form
70       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
71       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
72       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
73       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
74       event of any discrepancy between this version and the original IEEE and
75       The  Open Group Standard, the original IEEE and The Open Group Standard
76       is the referee document. The original Standard can be  obtained  online
77       at http://www.opengroup.org/unix/online.html .
78
79       Any  typographical  or  formatting  errors that appear in this page are
80       most likely to have been introduced during the conversion of the source
81       files  to  man page format. To report such errors, see https://www.ker
82       nel.org/doc/man-pages/reporting_bugs.html .
83
84
85
86IEEE/The Open Group                  2017                           SETGID(3P)
Impressum