Debian Codegraph @

upstream/debian-unstable/man3/initgroups.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH initgroups 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 initgroups \- initialize the supplementary group access list
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <sys/types.h>
16 .B #include <grp.h>
17 .P
18 .BI "int initgroups(const char *" user ", gid_t " group );
19 .fi
20 .P
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
25 .P
26 .BR initgroups ():
27 .nf
28 Since glibc 2.19:
29 _DEFAULT_SOURCE
30 glibc 2.19 and earlier:
31 _BSD_SOURCE
32 .fi
33 .SH DESCRIPTION
34 The
35 .BR initgroups ()
36 function initializes the group access list by
37 reading the group database
38 .I /etc/group
39 and using all groups of
40 which
41 .I user
42 is a member.
43 The additional group
44 .I group
45 is
46 also added to the list.
47 .P
48 The
49 .I user
50 argument must be non-NULL.
51 .SH RETURN VALUE
52 The
53 .BR initgroups ()
54 function returns 0 on success.
55 On error, \-1 is returned, and
56 .I errno
57 is set to indicate the error.
58 .SH ERRORS
59 .TP
60 .B ENOMEM
61 Insufficient memory to allocate group information structure.
62 .TP
63 .B EPERM
64 The calling process has insufficient privilege.
65 See the underlying system call
66 .BR setgroups (2).
67 .SH FILES
68 .TP
69 .I /etc/group
70 group database file
71 .SH ATTRIBUTES
72 For an explanation of the terms used in this section, see
73 .BR attributes (7).
74 .TS
75 allbox;
76 lbx lb lb
77 l l l.
78 Interface Attribute Value
79 T{
80 .na
81 .nh
82 .BR initgroups ()
83 T} Thread safety MT-Safe locale
84 .TE
85 .SH STANDARDS
86 None.
87 .SH HISTORY
88 SVr4, 4.3BSD.
89 .SH SEE ALSO
90 .BR getgroups (2),
91 .BR setgroups (2),
92 .BR credentials (7)