1SETGID(2)                  Linux Programmer's Manual                 SETGID(2)
2
3
4

NAME

6       setgid - set group identity
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <unistd.h>
11
12       int setgid(gid_t gid);
13

DESCRIPTION

15       setgid()  sets  the  effective group ID of the calling process.  If the
16       caller is the superuser, the real GID and saved set-group-ID  are  also
17       set.
18
19       Under  Linux,  setgid()  is implemented like the POSIX version with the
20       _POSIX_SAVED_IDS feature.  This allows a set-group-ID program  that  is
21       not  set-user-ID-root  to drop all of its group privileges, do some un-
22       privileged work, and then re-engage the original effective group ID  in
23       a secure manner.
24

RETURN VALUE

26       On  success,  zero is returned.  On error, -1 is returned, and errno is
27       set appropriately.
28

ERRORS

30       EPERM  The calling  process  is  not  privileged  (does  not  have  the
31              CAP_SETGID  capability),  and  gid  does not match the effective
32              group ID or saved set-group-ID of the calling process.
33

CONFORMING TO

35       SVr4, POSIX.1-2001.
36

SEE ALSO

38       getgid(2), setegid(2), setregid(2), capabilities(7), credentials(7)
39

COLOPHON

41       This page is part of release 3.22 of the Linux  man-pages  project.   A
42       description  of  the project, and information about reporting bugs, can
43       be found at http://www.kernel.org/doc/man-pages/.
44
45
46
47Linux                             2002-03-09                         SETGID(2)
Impressum