1initgroups(3)              Library Functions Manual              initgroups(3)
2
3
4

NAME

6       initgroups - initialize the supplementary group access list
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

33       The  initgroups()  function  returns 0 on success.  On error, -1 is re‐
34       turned, and errno is set to indicate the error.
35

ERRORS

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

FILES

43       /etc/group
44              group database file
45

ATTRIBUTES

47       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
48       tributes(7).
49
50       ┌─────────────────────────────────────┬───────────────┬────────────────┐
51Interface                            Attribute     Value          
52       ├─────────────────────────────────────┼───────────────┼────────────────┤
53initgroups()                         │ Thread safety │ MT-Safe locale │
54       └─────────────────────────────────────┴───────────────┴────────────────┘
55

STANDARDS

57       None.
58

HISTORY

60       SVr4, 4.3BSD.
61

SEE ALSO

63       getgroups(2), setgroups(2), credentials(7)
64
65
66
67Linux man-pages 6.05              2023-07-20                     initgroups(3)
Impressum