Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{pwd} --- |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 | The password database} |
| 3 | |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 4 | \declaremodule{builtin}{pwd} |
Fred Drake | a54a887 | 1999-03-02 17:03:42 +0000 | [diff] [blame] | 5 | \platform{Unix} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 6 | \modulesynopsis{The password database (\function{getpwnam()} and friends).} |
| 7 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 8 | This module provides access to the \UNIX{} password database. |
| 9 | It is available on all \UNIX{} versions. |
| 10 | |
| 11 | Password database entries are reported as 7-tuples containing the |
Fred Drake | a5aefba | 1998-08-14 17:05:17 +0000 | [diff] [blame] | 12 | following items from the password database (see \code{<pwd.h>}), in order: |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 13 | \code{pw_name}, |
| 14 | \code{pw_passwd}, |
| 15 | \code{pw_uid}, |
| 16 | \code{pw_gid}, |
| 17 | \code{pw_gecos}, |
| 18 | \code{pw_dir}, |
| 19 | \code{pw_shell}. |
| 20 | The uid and gid items are integers, all others are strings. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 21 | \exception{KeyError} is raised if the entry asked for cannot be found. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 22 | |
| 23 | It defines the following items: |
| 24 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 25 | \begin{funcdesc}{getpwuid}{uid} |
| 26 | Return the password database entry for the given numeric user ID. |
| 27 | \end{funcdesc} |
| 28 | |
| 29 | \begin{funcdesc}{getpwnam}{name} |
| 30 | Return the password database entry for the given user name. |
| 31 | \end{funcdesc} |
| 32 | |
| 33 | \begin{funcdesc}{getpwall}{} |
| 34 | Return a list of all available password database entries, in arbitrary order. |
| 35 | \end{funcdesc} |