1 .\" Copyright (C), 1994, Graeme W. Wilford. (Wilf.)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Fri Jul 29th 12:56:44 BST 1994 Wilf. <G.Wilford@ee.surrey.ac.uk>
26 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
27 .\" Modified 2002-03-09 by aeb
29 .TH SETGID 2 2014-09-21 "Linux" "Linux Programmer's Manual"
31 setgid \- set group identity
33 .B #include <sys/types.h>
35 .B #include <unistd.h>
37 .BI "int setgid(gid_t " gid );
40 sets the effective group ID of the calling process.
42 superuser, the real GID and saved set-group-ID are also set.
46 is implemented like the POSIX version with the
49 This allows a set-group-ID program that is not set-user-ID-root
50 to drop all of its group
51 privileges, do some un-privileged work, and then reengage the original
52 effective group ID in a secure manner.
54 On success, zero is returned.
55 On error, \-1 is returned, and
61 The group ID specified in
63 is not valid in this user namespace.
66 The calling process is not privileged (does not have the
67 \fBCAP_SETGID\fP capability), and
69 does not match the real group ID or saved set-group-ID of
76 system call supported only 16-bit group IDs.
77 Subsequently, Linux 2.4 added
79 supporting 32-bit IDs.
82 wrapper function transparently deals with the variation across kernel versions.
89 .BR user_namespaces (7)
91 This page is part of release 3.79 of the Linux
94 A description of the project,
95 information about reporting bugs,
96 and the latest version of this page,
98 \%http://www.kernel.org/doc/man\-pages/.