1INITGROUPS(3) Linux Programmer's Manual INITGROUPS(3)
2
3
4
6 initgroups - initialize the supplementary group access list
7
9 #include <sys/types.h>
10 #include <grp.h>
11
12 int initgroups(const char *user, gid_t group);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 initgroups():
17 Since glibc 2.19:
18 _DEFAULT_SOURCE
19 Glibc 2.19 and earlier:
20 _BSD_SOURCE
21
23 The initgroups() function initializes the group access list by reading
24 the group database /etc/group and using all groups of which user is a
25 member. The additional group group is also added to the list.
26
27 The user argument must be non-NULL.
28
30 The initgroups() function returns 0 on success. On error, -1 is
31 returned, and errno is set appropriately.
32
34 ENOMEM Insufficient memory to allocate group information structure.
35
36 EPERM The calling process has insufficient privilege. See the under‐
37 lying system call setgroups(2).
38
40 /etc/group
41 group database file
42
44 For an explanation of the terms used in this section, see
45 attributes(7).
46
47 ┌─────────────┬───────────────┬────────────────┐
48 │Interface │ Attribute │ Value │
49 ├─────────────┼───────────────┼────────────────┤
50 │initgroups() │ Thread safety │ MT-Safe locale │
51 └─────────────┴───────────────┴────────────────┘
52
54 SVr4, 4.3BSD.
55
57 getgroups(2), setgroups(2), credentials(7)
58
60 This page is part of release 4.16 of the Linux man-pages project. A
61 description of the project, information about reporting bugs, and the
62 latest version of this page, can be found at
63 https://www.kernel.org/doc/man-pages/.
64
65
66
67GNU 2017-09-15 INITGROUPS(3)