| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-crypt.html" /> |
| 13 | <link rel="prev" href="module-pwd.html" /> |
| 14 | <link rel="parent" href="unix.html" /> |
| 15 | <link rel="next" href="module-crypt.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>8.3 grp -- The group database</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="8.2 pwd " |
| 25 | href="module-pwd.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="8. Unix Specific Services" |
| 28 | href="unix.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="8.4 crypt " |
| 31 | href="module-crypt.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-pwd.html">8.2 pwd </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="unix.html">8. Unix Specific Services</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="module-crypt.html">8.4 crypt </A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION0010300000000000000000"> |
| 56 | 8.3 <tt class="module">grp</tt> -- |
| 57 | The group database</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-grp"></A> |
| 62 | <p class="availability">Availability: <span |
| 63 | class="platform">Unix</span>.</p> |
| 64 | |
| 65 | <P> |
| 66 | This module provides access to the <span class="Unix">Unix</span> group database. |
| 67 | It is available on all <span class="Unix">Unix</span> versions. |
| 68 | |
| 69 | <P> |
| 70 | Group database entries are reported as a tuple-like object, whose |
| 71 | attributes correspond to the members of the <code>group</code> structure |
| 72 | (Attribute field below, see <code><pwd.h></code>): |
| 73 | |
| 74 | <P> |
| 75 | <div class="center"><table class="realtable"> |
| 76 | <thead> |
| 77 | <tr> |
| 78 | <th class="right" >Index</th> |
| 79 | <th class="left" >Attribute</th> |
| 80 | <th class="left" >Meaning</th> |
| 81 | </tr> |
| 82 | </thead> |
| 83 | <tbody> |
| 84 | <tr><td class="right" valign="baseline">0</td> |
| 85 | <td class="left" >gr_name</td> |
| 86 | <td class="left" >the name of the group</td></tr> |
| 87 | <tr><td class="right" valign="baseline">1</td> |
| 88 | <td class="left" >gr_passwd</td> |
| 89 | <td class="left" >the (encrypted) group password; often empty</td></tr> |
| 90 | <tr><td class="right" valign="baseline">2</td> |
| 91 | <td class="left" >gr_gid</td> |
| 92 | <td class="left" >the numerical group ID</td></tr> |
| 93 | <tr><td class="right" valign="baseline">3</td> |
| 94 | <td class="left" >gr_mem</td> |
| 95 | <td class="left" >all the group member's user names</td></tr></tbody> |
| 96 | </table></div> |
| 97 | |
| 98 | <P> |
| 99 | The gid is an integer, name and password are strings, and the member |
| 100 | list is a list of strings. |
| 101 | (Note that most users are not explicitly listed as members of the |
| 102 | group they are in according to the password database. Check both |
| 103 | databases to get complete membership information.) |
| 104 | |
| 105 | <P> |
| 106 | It defines the following items: |
| 107 | |
| 108 | <P> |
| 109 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 110 | <td><nobr><b><tt id='l2h-2978' xml:id='l2h-2978' class="function">getgrgid</tt></b>(</nobr></td> |
| 111 | <td><var>gid</var>)</td></tr></table></dt> |
| 112 | <dd> |
| 113 | Return the group database entry for the given numeric group ID. |
| 114 | <tt class="exception">KeyError</tt> is raised if the entry asked for cannot be found. |
| 115 | </dl> |
| 116 | |
| 117 | <P> |
| 118 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 119 | <td><nobr><b><tt id='l2h-2979' xml:id='l2h-2979' class="function">getgrnam</tt></b>(</nobr></td> |
| 120 | <td><var>name</var>)</td></tr></table></dt> |
| 121 | <dd> |
| 122 | Return the group database entry for the given group name. |
| 123 | <tt class="exception">KeyError</tt> is raised if the entry asked for cannot be found. |
| 124 | </dl> |
| 125 | |
| 126 | <P> |
| 127 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 128 | <td><nobr><b><tt id='l2h-2980' xml:id='l2h-2980' class="function">getgrall</tt></b>(</nobr></td> |
| 129 | <td><var></var>)</td></tr></table></dt> |
| 130 | <dd> |
| 131 | Return a list of all available group entries, in arbitrary order. |
| 132 | </dl> |
| 133 | |
| 134 | <P> |
| 135 | <div class="seealso"> |
| 136 | <p class="heading">See Also:</p> |
| 137 | |
| 138 | <dl compact="compact" class="seemodule"> |
| 139 | <dt>Module <b><tt class="module"><a href="module-pwd.html">pwd</a></tt>:</b> |
| 140 | <dd>An interface to the user database, similar to this. |
| 141 | </dl> |
| 142 | </div> |
| 143 | |
| 144 | <DIV CLASS="navigation"> |
| 145 | <div class='online-navigation'> |
| 146 | <p></p><hr /> |
| 147 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 148 | <tr> |
| 149 | <td class='online-navigation'><a rel="prev" title="8.2 pwd " |
| 150 | href="module-pwd.html"><img src='../icons/previous.png' |
| 151 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 152 | <td class='online-navigation'><a rel="parent" title="8. Unix Specific Services" |
| 153 | href="unix.html"><img src='../icons/up.png' |
| 154 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 155 | <td class='online-navigation'><a rel="next" title="8.4 crypt " |
| 156 | href="module-crypt.html"><img src='../icons/next.png' |
| 157 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 158 | <td align="center" width="100%">Python Library Reference</td> |
| 159 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 160 | href="contents.html"><img src='../icons/contents.png' |
| 161 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 162 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 163 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 164 | <td class='online-navigation'><a rel="index" title="Index" |
| 165 | href="genindex.html"><img src='../icons/index.png' |
| 166 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 167 | </tr></table> |
| 168 | <div class='online-navigation'> |
| 169 | <b class="navlabel">Previous:</b> |
| 170 | <a class="sectref" rel="prev" href="module-pwd.html">8.2 pwd </A> |
| 171 | <b class="navlabel">Up:</b> |
| 172 | <a class="sectref" rel="parent" href="unix.html">8. Unix Specific Services</A> |
| 173 | <b class="navlabel">Next:</b> |
| 174 | <a class="sectref" rel="next" href="module-crypt.html">8.4 crypt </A> |
| 175 | </div> |
| 176 | </div> |
| 177 | <hr /> |
| 178 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 179 | </DIV> |
| 180 | <!--End of Navigation Panel--> |
| 181 | <ADDRESS> |
| 182 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 183 | </ADDRESS> |
| 184 | </BODY> |
| 185 | </HTML> |