Back to module index
Go to module by name
spwd
This module provides access to the Unix shadow password database.
It is available on various Unix versions.
Shadow password database entries are reported as 9-tuples of type struct_spwd,
containing the following items from the password database (see `<shadow.h>'):
sp_namp, sp_pwdp, sp_lstchg, sp_min, sp_max, sp_warn, sp_inact, sp_expire, sp_flag.
The sp_namp and sp_pwdp are strings, the rest are integers.
An exception is raised if the entry asked for cannot be found.
You have to be root to be able to use this module.
Classes
struct_spwd
spwd.struct_spwd: Results from getsp*() routines.
This object may be accessed either as a 9-tuple of
(sp_namp,sp_pwdp,sp_lstchg,sp_min,sp_max,sp_warn,sp_inact,sp_expire,sp_flag)
or via the object attributes as named in the above tuple.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
n_fields = 11
n_sequence_fields = 9
n_unnamed_fields = 0
sp_expire = <member 'sp_expire' of 'spwd.struct_spwd' objects>
#days since 1970-01-01 when account expires
sp_flag = <member 'sp_flag' of 'spwd.struct_spwd' objects>
reserved
sp_inact = <member 'sp_inact' of 'spwd.struct_spwd' objects>
#days after pw expires until account is disabled
sp_lstchg = <member 'sp_lstchg' of 'spwd.struct_spwd' objects>
date of last change
sp_max = <member 'sp_max' of 'spwd.struct_spwd' objects>
max #days between changes
sp_min = <member 'sp_min' of 'spwd.struct_spwd' objects>
min #days between changes
sp_nam = <member 'sp_nam' of 'spwd.struct_spwd' objects>
login name; deprecated
sp_namp = <member 'sp_namp' of 'spwd.struct_spwd' objects>
login name
sp_pwd = <member 'sp_pwd' of 'spwd.struct_spwd' objects>
encrypted password; deprecated
sp_pwdp = <member 'sp_pwdp' of 'spwd.struct_spwd' objects>
encrypted password
sp_warn = <member 'sp_warn' of 'spwd.struct_spwd' objects>
#days before pw expires to warn user about it
Functions
getspall
getspall()
Return a list of all available shadow password database entries, in arbitrary order.
See `help(spwd)` for more on shadow password database entries.
getspnam
getspnam(arg, /)
Return the shadow password database entry for the given user name.
See `help(spwd)` for more on shadow password database entries.