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
11

NAME

13       setgid — set-group-ID
14

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

52       None.
53

APPLICATION USAGE

55       None.
56

RATIONALE

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

FUTURE DIRECTIONS

61       None.
62

SEE ALSO

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