Unix Platform Modules

pwd

Reads Unix account database records by name or user ID. Records can expose account names, home paths and shell settings; the password field is not a reliable authentication source. Use appropriate authentication services rather than interpreting these records as credentials. The example inspects the record type only.

Formal Syntax & Structure

python syntaxpython
import pwd

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import pwdprint("pw_uid" in dir(pwd.struct_passwd))
Python Reference