/Doc/library/grp.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 63 lines · 41 code · 22 blank · 0 comment · 0 complexity · e4b05c049929a3efc8e326687844a6d6 MD5 · raw file

  1. :mod:`grp` --- The group database
  2. =================================
  3. .. module:: grp
  4. :platform: Unix
  5. :synopsis: The group database (getgrnam() and friends).
  6. This module provides access to the Unix group database. It is available on all
  7. Unix versions.
  8. Group database entries are reported as a tuple-like object, whose attributes
  9. correspond to the members of the ``group`` structure (Attribute field below, see
  10. ``<pwd.h>``):
  11. +-------+-----------+---------------------------------+
  12. | Index | Attribute | Meaning |
  13. +=======+===========+=================================+
  14. | 0 | gr_name | the name of the group |
  15. +-------+-----------+---------------------------------+
  16. | 1 | gr_passwd | the (encrypted) group password; |
  17. | | | often empty |
  18. +-------+-----------+---------------------------------+
  19. | 2 | gr_gid | the numerical group ID |
  20. +-------+-----------+---------------------------------+
  21. | 3 | gr_mem | all the group member's user |
  22. | | | names |
  23. +-------+-----------+---------------------------------+
  24. The gid is an integer, name and password are strings, and the member list is a
  25. list of strings. (Note that most users are not explicitly listed as members of
  26. the group they are in according to the password database. Check both databases
  27. to get complete membership information.)
  28. It defines the following items:
  29. .. function:: getgrgid(gid)
  30. Return the group database entry for the given numeric group ID. :exc:`KeyError`
  31. is raised if the entry asked for cannot be found.
  32. .. function:: getgrnam(name)
  33. Return the group database entry for the given group name. :exc:`KeyError` is
  34. raised if the entry asked for cannot be found.
  35. .. function:: getgrall()
  36. Return a list of all available group entries, in arbitrary order.
  37. .. seealso::
  38. Module :mod:`pwd`
  39. An interface to the user database, similar to this.
  40. Module :mod:`spwd`
  41. An interface to the shadow password database, similar to this.