pwd
index
(built-in)

This module provides access to the Unix password database.
It is available on all Unix versions.
 
Password database entries are reported as 7-tuples containing the following
items from the password database (see `<pwd.h>'), in order:
pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell.
The uid and gid items are integers, all others are strings. An
exception is raised if the entry asked for cannot be found.

 
Classes
       
__builtin__.object
struct_passwd

 
class struct_passwd(__builtin__.object)
    pwd.struct_passwd: Results from getpw*() routines.
 
This object may be accessed either as a tuple of
  (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)
or via the object attributes as named in the above tuple.
 
  Methods defined here:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__hash__(...)
x.__hash__() <==> hash(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__rmul__(...)
x.__rmul__(n) <==> n*x

Data descriptors defined here:
pw_dir
home directory
pw_gecos
real name
pw_gid
group id
pw_name
user name
pw_passwd
password
pw_shell
shell program
pw_uid
user id

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
n_fields = 7
n_sequence_fields = 7
n_unnamed_fields = 0

 
struct_pwent = class struct_passwd(__builtin__.object)
    pwd.struct_passwd: Results from getpw*() routines.
 
This object may be accessed either as a tuple of
  (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)
or via the object attributes as named in the above tuple.
 
  Methods defined here:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__hash__(...)
x.__hash__() <==> hash(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__rmul__(...)
x.__rmul__(n) <==> n*x

Data descriptors defined here:
pw_dir
home directory
pw_gecos
real name
pw_gid
group id
pw_name
user name
pw_passwd
password
pw_shell
shell program
pw_uid
user id

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
n_fields = 7
n_sequence_fields = 7
n_unnamed_fields = 0

 
Functions
       
getpwall(...)
getpwall() -> list_of_entries
Return a list of all available password database entries, in arbitrary order.
See help(pwd) for more on password database entries.
getpwnam(...)
getpwnam(name) -> (pw_name,pw_passwd,pw_uid,
                    pw_gid,pw_gecos,pw_dir,pw_shell)
Return the password database entry for the given user name.
See help(pwd) for more on password database entries.
getpwuid(...)
getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,
                  pw_gid,pw_gecos,pw_dir,pw_shell)
Return the password database entry for the given numeric user ID.
See help(pwd) for more on password database entries.