summaryrefslogtreecommitdiff
path: root/devdocs/python~3.12/library%2Fpwd.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/python~3.12/library%2Fpwd.html
new repository
Diffstat (limited to 'devdocs/python~3.12/library%2Fpwd.html')
-rw-r--r--devdocs/python~3.12/library%2Fpwd.html31
1 files changed, 31 insertions, 0 deletions
diff --git a/devdocs/python~3.12/library%2Fpwd.html b/devdocs/python~3.12/library%2Fpwd.html
new file mode 100644
index 00000000..578fb27b
--- /dev/null
+++ b/devdocs/python~3.12/library%2Fpwd.html
@@ -0,0 +1,31 @@
+ <span id="pwd-the-password-database"></span><h1>pwd — The password database</h1> <p>This module provides access to the Unix user account and password database. It is available on all Unix versions.</p> <div class="availability docutils container"> <p><a class="reference internal" href="https://docs.python.org/3.12/library/intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, not Emscripten, not WASI.</p> </div> <p>Password database entries are reported as a tuple-like object, whose attributes correspond to the members of the <code>passwd</code> structure (Attribute field below, see <code>&lt;pwd.h&gt;</code>):</p> <table class="docutils align-default"> <thead> <tr>
+<th class="head"><p>Index</p></th> <th class="head"><p>Attribute</p></th> <th class="head"><p>Meaning</p></th> </tr> </thead> <tr>
+<td><p>0</p></td> <td><p><code>pw_name</code></p></td> <td><p>Login name</p></td> </tr> <tr>
+<td><p>1</p></td> <td><p><code>pw_passwd</code></p></td> <td><p>Optional encrypted password</p></td> </tr> <tr>
+<td><p>2</p></td> <td><p><code>pw_uid</code></p></td> <td><p>Numerical user ID</p></td> </tr> <tr>
+<td><p>3</p></td> <td><p><code>pw_gid</code></p></td> <td><p>Numerical group ID</p></td> </tr> <tr>
+<td><p>4</p></td> <td><p><code>pw_gecos</code></p></td> <td><p>User name or comment field</p></td> </tr> <tr>
+<td><p>5</p></td> <td><p><code>pw_dir</code></p></td> <td><p>User home directory</p></td> </tr> <tr>
+<td><p>6</p></td> <td><p><code>pw_shell</code></p></td> <td><p>User command interpreter</p></td> </tr> </table> <p>The uid and gid items are integers, all others are strings. <a class="reference internal" href="exceptions#KeyError" title="KeyError"><code>KeyError</code></a> is raised if the entry asked for cannot be found.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p id="index-0">In traditional Unix the field <code>pw_passwd</code> usually contains a password encrypted with a DES derived algorithm (see module <a class="reference internal" href="crypt#module-crypt" title="crypt: The crypt() function used to check Unix passwords. (deprecated) (Unix)"><code>crypt</code></a>). However most modern unices use a so-called <em>shadow password</em> system. On those unices the <em>pw_passwd</em> field only contains an asterisk (<code>'*'</code>) or the letter <code>'x'</code> where the encrypted password is stored in a file <code>/etc/shadow</code> which is not world readable. Whether the <em>pw_passwd</em> field contains anything useful is system-dependent. If available, the <a class="reference internal" href="spwd#module-spwd" title="spwd: The shadow password database (getspnam() and friends). (deprecated) (Unix)"><code>spwd</code></a> module should be used where access to the encrypted password is required.</p> </div> <p>It defines the following items:</p> <dl class="py function"> <dt class="sig sig-object py" id="pwd.getpwuid">
+<code>pwd.getpwuid(uid)</code> </dt> <dd>
+<p>Return the password database entry for the given numeric user ID.</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="pwd.getpwnam">
+<code>pwd.getpwnam(name)</code> </dt> <dd>
+<p>Return the password database entry for the given user name.</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="pwd.getpwall">
+<code>pwd.getpwall()</code> </dt> <dd>
+<p>Return a list of all available password database entries, in arbitrary order.</p> </dd>
+</dl> <div class="admonition seealso"> <p class="admonition-title">See also</p> <dl class="simple"> <dt>
+<code>Module</code> <a class="reference internal" href="grp#module-grp" title="grp: The group database (getgrnam() and friends). (Unix)"><code>grp</code></a>
+</dt>
+<dd>
+<p>An interface to the group database, similar to this.</p> </dd> <dt>
+<code>Module</code> <a class="reference internal" href="spwd#module-spwd" title="spwd: The shadow password database (getspnam() and friends). (deprecated) (Unix)"><code>spwd</code></a>
+</dt>
+<dd>
+<p>An interface to the shadow password database, similar to this.</p> </dd> </dl> </div> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2001&ndash;2023 Python Software Foundation<br>Licensed under the PSF License.<br>
+ <a href="https://docs.python.org/3.12/library/pwd.html" class="_attribution-link">https://docs.python.org/3.12/library/pwd.html</a>
+ </p>
+</div>