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