cid d8d612e288f0e8fd378271ff3158d8d161fac08e810ce28d0d9a9acc5db154a2 · original · open access · via pydoc
Title: pwd — The password database — Python 3.13.18 documentation
Authors:
Venue: pydoc
Year: 2001
Canonical: pydoc:pwd@3.13
URL: https://docs.python.org/3.13/library/pwd.html
Collector: pydoc
OA: true
ABSTRACT
pwd — The password database — Python 3.13.18 documentation Navigation index modules | next | previous | Python » 3.13.18 Documentation » The Python standard library » Unix-specific services » pwd — The password database | Theme Auto Light Dark | pwd — The password database¶ This module provides access to the Unix user account and password database. It is available on all Unix versions. Availability: Unix, not WASI, not iOS. Password database entries are reported as a tuple-like object, whose attributes correspond to the members of the passwd structure (Attribute field below, see ): Index Attribute 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. However most modern unices use a so-called shadow password system. On those unices the pw_passwd field only contains an asterisk ('*') or the letter 'x' where the encrypted password is stored in a file /etc/shadow which is not world readable. Whether the pw_passwd field contains anything useful is system-dependent. It defines the following items: pwd.getpwuid(uid)¶ Return the password database entry for the given numeric user ID. pwd.getpwnam(name)¶ Return the password database entry for the given user name. pwd.getpwall()¶ Return a list of all available password database entries, in arbitrary order. See also Module grpAn interface to the group database, similar to this. Previous topic posix — The most common POSIX system calls Next topic grp — The group database This page Report a bug Show source « Navigation index modules | next | previous | Python » 3.13.18 Documentation » The Python standard library » Unix-specific services » pwd — The password database | Theme Auto Light Dark | © Copyright 2001-2026, Python Software Foundation. This page is licensed under the Python Software Foundation License Version 2. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. See History and License for more information. The Python Software Foundation is a non-profit corporation. Please donate. Last updated on Oct 26, 2026 (13:10 UTC). Found a bug? Created using Sphinx 8.2.3.