1initgroups(3) Library Functions Manual initgroups(3)
2
3
4
6 initgroups - initialize the supplementary group access list
7
9 Standard C library (libc, -lc)
10
12 #include <sys/types.h>
13 #include <grp.h>
14
15 int initgroups(const char *user, gid_t group);
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 initgroups():
20 Since glibc 2.19:
21 _DEFAULT_SOURCE
22 glibc 2.19 and earlier:
23 _BSD_SOURCE
24
26 The initgroups() function initializes the group access list by reading
27 the group database /etc/group and using all groups of which user is a
28 member. The additional group group is also added to the list.
29
30 The user argument must be non-NULL.
31
33 The initgroups() function returns 0 on success. On error, -1 is re‐
34 turned, and errno is set to indicate the error.
35
37 ENOMEM Insufficient memory to allocate group information structure.
38
39 EPERM The calling process has insufficient privilege. See the under‐
40 lying system call setgroups(2).
41
43 /etc/group
44 group database file
45
47 For an explanation of the terms used in this section, see at‐
48 tributes(7).
49
50 ┌─────────────────────────────────────┬───────────────┬────────────────┐
51 │Interface │ Attribute │ Value │
52 ├─────────────────────────────────────┼───────────────┼────────────────┤
53 │initgroups() │ Thread safety │ MT-Safe locale │
54 └─────────────────────────────────────┴───────────────┴────────────────┘
55
57 None.
58
60 SVr4, 4.3BSD.
61
63 getgroups(2), setgroups(2), credentials(7)
64
65
66
67Linux man-pages 6.05 2023-07-20 initgroups(3)