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