Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | :mod:`spwd` --- The shadow password database |
| 2 | ============================================ |
| 3 | |
| 4 | .. module:: spwd |
| 5 | :platform: Unix |
| 6 | :synopsis: The shadow password database (getspnam() and friends). |
| 7 | |
| 8 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 9 | This module provides access to the Unix shadow password database. It is |
| 10 | available on various Unix versions. |
| 11 | |
| 12 | You must have enough privileges to access the shadow password database (this |
| 13 | usually means you have to be root). |
| 14 | |
| 15 | Shadow password database entries are reported as a tuple-like object, whose |
| 16 | attributes correspond to the members of the ``spwd`` structure (Attribute field |
| 17 | below, see ``<shadow.h>``): |
| 18 | |
| 19 | +-------+---------------+---------------------------------+ |
| 20 | | Index | Attribute | Meaning | |
| 21 | +=======+===============+=================================+ |
| 22 | | 0 | ``sp_nam`` | Login name | |
| 23 | +-------+---------------+---------------------------------+ |
| 24 | | 1 | ``sp_pwd`` | Encrypted password | |
| 25 | +-------+---------------+---------------------------------+ |
| 26 | | 2 | ``sp_lstchg`` | Date of last change | |
| 27 | +-------+---------------+---------------------------------+ |
| 28 | | 3 | ``sp_min`` | Minimal number of days between | |
| 29 | | | | changes | |
| 30 | +-------+---------------+---------------------------------+ |
| 31 | | 4 | ``sp_max`` | Maximum number of days between | |
| 32 | | | | changes | |
| 33 | +-------+---------------+---------------------------------+ |
| 34 | | 5 | ``sp_warn`` | Number of days before password | |
| 35 | | | | expires to warn user about it | |
| 36 | +-------+---------------+---------------------------------+ |
| 37 | | 6 | ``sp_inact`` | Number of days after password | |
| 38 | | | | expires until account is | |
| 39 | | | | blocked | |
| 40 | +-------+---------------+---------------------------------+ |
| 41 | | 7 | ``sp_expire`` | Number of days since 1970-01-01 | |
| 42 | | | | until account is disabled | |
| 43 | +-------+---------------+---------------------------------+ |
| 44 | | 8 | ``sp_flag`` | Reserved | |
| 45 | +-------+---------------+---------------------------------+ |
| 46 | |
| 47 | The sp_nam and sp_pwd items are strings, all others are integers. |
| 48 | :exc:`KeyError` is raised if the entry asked for cannot be found. |
| 49 | |
Georg Brandl | b044b2a | 2009-09-16 16:05:59 +0000 | [diff] [blame] | 50 | The following functions are defined: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 51 | |
| 52 | |
| 53 | .. function:: getspnam(name) |
| 54 | |
| 55 | Return the shadow password database entry for the given user name. |
| 56 | |
| 57 | |
| 58 | .. function:: getspall() |
| 59 | |
| 60 | Return a list of all available shadow password database entries, in arbitrary |
| 61 | order. |
| 62 | |
| 63 | |
| 64 | .. seealso:: |
| 65 | |
| 66 | Module :mod:`grp` |
| 67 | An interface to the group database, similar to this. |
| 68 | |
| 69 | Module :mod:`pwd` |
| 70 | An interface to the normal password database, similar to this. |
| 71 | |