blob: 4d7e8b94aaee71f78f90f35e45759e5ee3a06782 [file] [log] [blame]
Fred Drake5ac2a071998-12-22 23:37:21 +00001\section{\module{getpass}
2 --- Portable password reading.}
3
4\declaremodule{standard}{getpass}
5\moduleauthor{Piers Lauder}{piers@cs.su.oz.au}
6% Windows support by Guido van Rossum.
7\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
8
9\modulesynopsis{Portable reading of passwords and retrieval of the userid.}
10
11
12The \module{getpass} module provides two functions:
13
14
15\begin{funcdesc}{getpass}{\optional{prompt}}
16 Prompt the user for a password without echoing. The user is
17 prompted using the string \var{prompt}, which defaults to
18 \code{'Password: '}.
19\end{funcdesc}
20
21
22\begin{funcdesc}{getuser}{}
23 Return the ``login name'' of the user.
24
25 This function checks the environment variables \envvar{LOGNAME},
26 \envvar{USER}, \envvar{LNAME} and \envvar{USERNAME}, in order, and
27 returns the value of the first one which is set to a non-empty
28 string. If none are set, the login name from the password database
29 is returned on systems which support the \module{pwd} module,
30 otherwise, an exception is raised.
31\end{funcdesc}