blob: 2925297630be52471f46b3fb7af5dc8c430eaae5 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{grp} ---
Fred Drakef6863c11999-03-02 16:37:17 +00002 The group database}
3
Fred Drakeb91e9341998-07-23 17:59:49 +00004\declaremodule{builtin}{grp}
Fred Drakea54a8871999-03-02 17:03:42 +00005 \platform{Unix}
Fred Drakeb91e9341998-07-23 17:59:49 +00006\modulesynopsis{The group database (\function{getgrnam()} and friends).}
7
Fred Drakef6863c11999-03-02 16:37:17 +00008
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00009This module provides access to the \UNIX{} group database.
10It is available on all \UNIX{} versions.
11
12Group database entries are reported as 4-tuples containing the
Fred Drakea5aefba1998-08-14 17:05:17 +000013following items from the group database (see \code{<grp.h>}), in order:
Fred Drake38e5d272000-04-03 20:13:55 +000014
15\begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Meaning}
16 \lineiii{0}{gr_name}{the name of the group}
17 \lineiii{1}{gr_passwd}{the (encrypted) group password; often empty}
18 \lineiii{2}{gr_gid}{the numerical group ID}
19 \lineiii{3}{gr_mem}{all the group member's user names}
20\end{tableiii}
21
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022The gid is an integer, name and password are strings, and the member
23list is a list of strings.
24(Note that most users are not explicitly listed as members of the
Guido van Rossum470be141995-03-17 16:07:09 +000025group they are in according to the password database.)
Fred Drakef6863c11999-03-02 16:37:17 +000026\exception{KeyError} is raised if the entry asked for cannot be found.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000027
28It defines the following items:
29
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000030\begin{funcdesc}{getgrgid}{gid}
31Return the group database entry for the given numeric group ID.
32\end{funcdesc}
33
34\begin{funcdesc}{getgrnam}{name}
35Return the group database entry for the given group name.
36\end{funcdesc}
37
38\begin{funcdesc}{getgrall}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000039Return a list of all available group entries, in arbitrary order.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000040\end{funcdesc}
Fred Drake38e5d272000-04-03 20:13:55 +000041
42
43\begin{seealso}
44 \seemodule{pwd}{An interface to the user database, similar to this.}
45\end{seealso}