1998-08-10 16:42:37 -03:00
|
|
|
\section{\module{pwd} ---
|
1999-03-02 12:37:17 -04:00
|
|
|
The password database}
|
1998-07-23 14:59:49 -03:00
|
|
|
|
1999-03-02 12:37:17 -04:00
|
|
|
\declaremodule{builtin}{pwd}
|
1999-03-02 13:03:42 -04:00
|
|
|
\platform{Unix}
|
1998-07-23 14:59:49 -03:00
|
|
|
\modulesynopsis{The password database (\function{getpwnam()} and friends).}
|
1994-01-01 21:22:07 -04:00
|
|
|
|
2000-04-03 17:13:55 -03:00
|
|
|
This module provides access to the \UNIX{} user account and password
|
|
|
|
database. It is available on all \UNIX{} versions.
|
1994-01-01 21:22:07 -04:00
|
|
|
|
2002-03-01 06:47:37 -04:00
|
|
|
Password database entries are reported as a tuple-like object, whose
|
|
|
|
attributes correspond to the members of the \code{passwd} structure
|
|
|
|
(Attribute field below, see \code{<pwd.h>}):
|
2000-04-03 17:13:55 -03:00
|
|
|
|
2002-03-01 06:47:37 -04:00
|
|
|
\begin{tableiii}{r|l|l}{textrm}{Index}{Attribute}{Meaning}
|
2000-04-03 17:13:55 -03:00
|
|
|
\lineiii{0}{\code{pw_name}}{Login name}
|
|
|
|
\lineiii{1}{\code{pw_passwd}}{Optional encrypted password}
|
|
|
|
\lineiii{2}{\code{pw_uid}}{Numerical user ID}
|
|
|
|
\lineiii{3}{\code{pw_gid}}{Numerical group ID}
|
|
|
|
\lineiii{4}{\code{pw_gecos}}{User name or comment field}
|
|
|
|
\lineiii{5}{\code{pw_dir}}{User home directory}
|
|
|
|
\lineiii{6}{\code{pw_shell}}{User command interpreter}
|
|
|
|
\end{tableiii}
|
|
|
|
|
1994-01-01 21:22:07 -04:00
|
|
|
The uid and gid items are integers, all others are strings.
|
1999-03-02 12:37:17 -04:00
|
|
|
\exception{KeyError} is raised if the entry asked for cannot be found.
|
1994-01-01 21:22:07 -04:00
|
|
|
|
2001-10-20 01:24:09 -03:00
|
|
|
\note{In traditional \UNIX{} the field \code{pw_passwd} usually
|
2000-04-03 17:13:55 -03:00
|
|
|
contains a password encrypted with a DES derived algorithm (see module
|
|
|
|
\refmodule{crypt}\refbimodindex{crypt}). However most modern unices
|
|
|
|
use a so-called \emph{shadow password} system. On those unices the
|
2005-03-02 00:29:23 -04:00
|
|
|
\var{pw_passwd} field only contains an asterisk (\code{'*'}) or the
|
2000-04-03 17:13:55 -03:00
|
|
|
letter \character{x} where the encrypted password is stored in a file
|
2005-03-02 00:29:23 -04:00
|
|
|
\file{/etc/shadow} which is not world readable. Whether the \var{pw_passwd}
|
|
|
|
field contains anything useful is system-dependent. If available, the
|
|
|
|
\module{spwd} module should be used where access to the encrypted password
|
|
|
|
is required.}
|
2000-04-03 17:13:55 -03:00
|
|
|
|
1994-01-01 21:22:07 -04:00
|
|
|
It defines the following items:
|
|
|
|
|
|
|
|
\begin{funcdesc}{getpwuid}{uid}
|
|
|
|
Return the password database entry for the given numeric user ID.
|
|
|
|
\end{funcdesc}
|
|
|
|
|
|
|
|
\begin{funcdesc}{getpwnam}{name}
|
|
|
|
Return the password database entry for the given user name.
|
|
|
|
\end{funcdesc}
|
|
|
|
|
|
|
|
\begin{funcdesc}{getpwall}{}
|
|
|
|
Return a list of all available password database entries, in arbitrary order.
|
|
|
|
\end{funcdesc}
|
2000-04-03 17:13:55 -03:00
|
|
|
|
|
|
|
|
|
|
|
\begin{seealso}
|
|
|
|
\seemodule{grp}{An interface to the group database, similar to this.}
|
2005-01-23 05:27:24 -04:00
|
|
|
\seemodule{spwd}{An interface to the shadow password database, similar to this.}
|
2000-04-03 17:13:55 -03:00
|
|
|
\end{seealso}
|