/Doc/library/spwd.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 74 lines · 53 code · 21 blank · 0 comment · 0 complexity · dc0eb5012290f698c7fba3a00d8bca05 MD5 · raw file

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