blob: 5f0e6f136888101accedc15a19b5eaec36d2bf11 [file] [log] [blame]
Martin v. Löwisc3001752005-01-23 09:27:24 +00001\section{\module{spwd} ---
2 The shadow password database}
3
4\declaremodule{builtin}{spwd}
5 \platform{Unix}
6\modulesynopsis{The shadow password database (\function{getspnam()} and friends).}
Georg Brandl7f26a622005-08-27 17:04:58 +00007\versionadded{2.5}
Martin v. Löwisc3001752005-01-23 09:27:24 +00008
9This module provides access to the \UNIX{} shadow password database.
Georg Brandl7f26a622005-08-27 17:04:58 +000010It is available on various \UNIX{} versions.
Martin v. Löwisc3001752005-01-23 09:27:24 +000011
12You must have enough privileges to access the shadow password database
13(this usually means you have to be root).
14
15Shadow password database entries are reported as a tuple-like object, whose
16attributes correspond to the members of the \code{spwd} structure
17(Attribute field below, see \code{<shadow.h>}):
18
19\begin{tableiii}{r|l|l}{textrm}{Index}{Attribute}{Meaning}
20 \lineiii{0}{\code{sp_nam}}{Login name}
21 \lineiii{1}{\code{sp_pwd}}{Encrypted password}
22 \lineiii{2}{\code{sp_lstchg}}{Date of last change}
23 \lineiii{3}{\code{sp_min}}{Minimal number of days between changes}
24 \lineiii{4}{\code{sp_max}}{Maximum number of days between changes}
25 \lineiii{5}{\code{sp_warn}}{Number of days before password expires to warn user about it}
26 \lineiii{6}{\code{sp_inact}}{Number of days after password expires until account is blocked}
27 \lineiii{7}{\code{sp_expire}}{Number of days since 1970-01-01 until account is disabled}
28 \lineiii{8}{\code{sp_flag}}{Reserved}
29\end{tableiii}
30
31The sp_nam and sp_pwd items are strings, all others are integers.
32\exception{KeyError} is raised if the entry asked for cannot be found.
33
34It defines the following items:
35
36\begin{funcdesc}{getspnam}{name}
37Return the shadow password database entry for the given user name.
38\end{funcdesc}
39
40\begin{funcdesc}{getspall}{}
41Return a list of all available shadow password database entries, in arbitrary order.
42\end{funcdesc}
43
44
45\begin{seealso}
Georg Brandl7f26a622005-08-27 17:04:58 +000046 \seemodule{grp}{An interface to the group database, similar to this.}
Martin v. Löwisc3001752005-01-23 09:27:24 +000047 \seemodule{pwd}{An interface to the normal password database, similar to this.}
48\end{seealso}