1 | \section{\module{grp} ---
|
---|
2 | The group database}
|
---|
3 |
|
---|
4 | \declaremodule{builtin}{grp}
|
---|
5 | \platform{Unix}
|
---|
6 | \modulesynopsis{The group database (\function{getgrnam()} and friends).}
|
---|
7 |
|
---|
8 |
|
---|
9 | This module provides access to the \UNIX{} group database.
|
---|
10 | It is available on all \UNIX{} versions.
|
---|
11 |
|
---|
12 | Group database entries are reported as a tuple-like object, whose
|
---|
13 | attributes correspond to the members of the \code{group} structure
|
---|
14 | (Attribute field below, see \code{<pwd.h>}):
|
---|
15 |
|
---|
16 | \begin{tableiii}{r|l|l}{textrm}{Index}{Attribute}{Meaning}
|
---|
17 | \lineiii{0}{gr_name}{the name of the group}
|
---|
18 | \lineiii{1}{gr_passwd}{the (encrypted) group password; often empty}
|
---|
19 | \lineiii{2}{gr_gid}{the numerical group ID}
|
---|
20 | \lineiii{3}{gr_mem}{all the group member's user names}
|
---|
21 | \end{tableiii}
|
---|
22 |
|
---|
23 | The gid is an integer, name and password are strings, and the member
|
---|
24 | list is a list of strings.
|
---|
25 | (Note that most users are not explicitly listed as members of the
|
---|
26 | group they are in according to the password database. Check both
|
---|
27 | databases to get complete membership information.)
|
---|
28 |
|
---|
29 | It defines the following items:
|
---|
30 |
|
---|
31 | \begin{funcdesc}{getgrgid}{gid}
|
---|
32 | Return the group database entry for the given numeric group ID.
|
---|
33 | \exception{KeyError} is raised if the entry asked for cannot be found.
|
---|
34 | \end{funcdesc}
|
---|
35 |
|
---|
36 | \begin{funcdesc}{getgrnam}{name}
|
---|
37 | Return the group database entry for the given group name.
|
---|
38 | \exception{KeyError} is raised if the entry asked for cannot be found.
|
---|
39 | \end{funcdesc}
|
---|
40 |
|
---|
41 | \begin{funcdesc}{getgrall}{}
|
---|
42 | Return a list of all available group entries, in arbitrary order.
|
---|
43 | \end{funcdesc}
|
---|
44 |
|
---|
45 |
|
---|
46 | \begin{seealso}
|
---|
47 | \seemodule{pwd}{An interface to the user database, similar to this.}
|
---|
48 | \seemodule{spwd}{An interface to the shadow password database, similar to this.}
|
---|
49 | \end{seealso}
|
---|