The password database
=====================
The password database (`getpwnam()' and friends).
This module provides access to the UNIX user account and password
database. It is available on all UNIX versions.
Password database entries are reported as 7-tuples containing the
following items from the password database (see `<pwd.h>'), in order:
Index Field Meaning
------ ----- -----
0 `pw_name' Login name
1 `pw_passwd' Optional encrypted
password
2 `pw_uid' Numerical user ID
3 `pw_gid' Numerical group ID
4 `pw_gecos' User name or comment
field
5 `pw_dir' User home directory
6 `pw_shell' User command interpreter
The uid and gid items are integers, all others are strings. `KeyError'
is raised if the entry asked for cannot be found.
*Note:* In traditional UNIX the field `pw_passwd' usually contains a
password encrypted with a DES derived algorithm (see module `crypt' ).
However most modern unices use a so-called _shadow password_ system.
On those unices the field `pw_passwd' only contains a asterisk (`'*'')
or the letter `x' where the encrypted password is stored in a file
`/etc/shadow' which is not world readable.
It defines the following items:
`getpwuid(uid)'
Return the password database entry for the given numeric user ID.
`getpwnam(name)'
Return the password database entry for the given user name.
`getpwall()'
Return a list of all available password database entries, in
arbitrary order.
See also:
Note:grp An interface to the group database, similar to this.