Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
newgrp.html (15988B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>newgrp</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mv.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/ngettext.html" accesskey="N">Next 19 >>></a></td> 20 </tr> 21 </table> 22 <hr align="left" width="100%"></div> 23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 24 <center><font size="2">The Open Group Base Specifications Issue 8<br> 25 IEEE Std 1003.1-2024<br> 26 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 27 <hr size="2" noshade> 28 <a name="top" id="top"></a> <a name="newgrp" id="newgrp"></a> <a name="tag_20_84" id="tag_20_84"></a><!-- newgrp --> 29 <h4 class="mansect"><a name="tag_20_84_01" id="tag_20_84_01"></a>NAME</h4> 30 <blockquote>newgrp — change to a new group</blockquote> 31 <h4 class="mansect"><a name="tag_20_84_02" id="tag_20_84_02"></a>SYNOPSIS</h4> 32 <blockquote class="synopsis"> 33 <p><code><tt>newgrp</tt> <b>[</b><tt>-l</tt><b>] [</b><i>group</i><b>]</b></code></p> 34 </blockquote> 35 <h4 class="mansect"><a name="tag_20_84_03" id="tag_20_84_03"></a>DESCRIPTION</h4> 36 <blockquote> 37 <p>The <i>newgrp</i> utility shall create a new shell execution environment with a new real and effective group identification. Of 38 the attributes listed in <a href="../utilities/V3_chap02.html#tag_19_13"><i>2.13 Shell Execution Environment</i></a> , the new 39 shell execution environment shall retain the working directory, file creation mask, and exported variables from the previous 40 environment (that is, open files, traps, unexported variables, alias definitions, shell functions, and <a href= 41 "../utilities/V3_chap02.html#set"><i>set</i></a> options may be lost). All other aspects of the process environment that are 42 preserved by the <i>exec</i> family of functions defined in the System Interfaces volume of POSIX.1-2024 shall also be preserved by 43 <i>newgrp</i>; whether other aspects are preserved is unspecified.</p> 44 <p>A failure to assign the new group identifications (for example, for security or password-related reasons) shall not prevent the 45 new shell execution environment from being created.</p> 46 <p>The <i>newgrp</i> utility shall affect the supplemental groups for the process as follows:</p> 47 <ul> 48 <li> 49 <p>On systems where the effective group ID is normally in the supplementary group list (or whenever the old effective group ID 50 actually is in the supplementary group list):</p> 51 <ul> 52 <li> 53 <p>If the new effective group ID is also in the supplementary group list, <i>newgrp</i> shall change the effective group ID.</p> 54 </li> 55 <li> 56 <p>If the new effective group ID is not in the supplementary group list, <i>newgrp</i> shall add the new effective group ID to the 57 list, if there is room to add it.</p> 58 </li> 59 </ul> 60 </li> 61 <li> 62 <p>On systems where the effective group ID is not normally in the supplementary group list (or whenever the old effective group ID 63 is not in the supplementary group list):</p> 64 <ul> 65 <li> 66 <p>If the new effective group ID is in the supplementary group list, <i>newgrp</i> shall delete it.</p> 67 </li> 68 <li> 69 <p>If the old effective group ID is not in the supplementary list, <i>newgrp</i> shall add it if there is room.</p> 70 </li> 71 </ul> 72 </li> 73 </ul> 74 <basefont size="2"> 75 <dl> 76 <dt><b>Note:</b></dt> 77 <dd>The System Interfaces volume of POSIX.1-2024 does not specify whether the effective group ID of a process is included in its 78 supplementary group list.</dd> 79 </dl> 80 <basefont size="3"> 81 <p>With no operands, <i>newgrp</i> shall change the effective group back to the groups identified in the user's user entry, and 82 shall set the list of supplementary groups to that set in the user's group database entries.</p> 83 <p>If the first argument is <tt>'-'</tt>, the results are unspecified.</p> 84 <p>If a password is required for the specified group, and the user is not listed as a member of that group in the group database, 85 the user shall be prompted to enter the correct password for that group. If the user is listed as a member of that group, no 86 password shall be requested. If no password is required for the specified group, it is implementation-defined whether users not 87 listed as members of that group can change to that group. Whether or not a password is required, implementation-defined system 88 accounting or security mechanisms may impose additional authorization restrictions that may cause <i>newgrp</i> to write a 89 diagnostic message and suppress the changing of the group identification.</p> 90 </blockquote> 91 <h4 class="mansect"><a name="tag_20_84_04" id="tag_20_84_04"></a>OPTIONS</h4> 92 <blockquote> 93 <p>The <i>newgrp</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 94 Guidelines</i></a> , except for the unspecified usage of <tt>'-'</tt>.</p> 95 <p>The following option shall be supported:</p> 96 <dl compact> 97 <dd></dd> 98 <dt><b>-l</b></dt> 99 <dd>(The letter ell.) Change the environment to what would be expected if the user actually logged in again.</dd> 100 </dl> 101 </blockquote> 102 <h4 class="mansect"><a name="tag_20_84_05" id="tag_20_84_05"></a>OPERANDS</h4> 103 <blockquote> 104 <p>The following operand shall be supported:</p> 105 <dl compact> 106 <dd></dd> 107 <dt><i>group</i></dt> 108 <dd>A group name from the group database or a non-negative numeric group ID. Specifies the group ID to which the real and effective 109 group IDs shall be set. If <i>group</i> is a non-negative numeric string and exists in the group database as a group name (see 110 <a href="../functions/getgrnam.html"><i>getgrnam</i>()</a>), the numeric group ID associated with that group name shall be used as 111 the group ID.</dd> 112 </dl> 113 </blockquote> 114 <h4 class="mansect"><a name="tag_20_84_06" id="tag_20_84_06"></a>STDIN</h4> 115 <blockquote> 116 <p>Not used.</p> 117 </blockquote> 118 <h4 class="mansect"><a name="tag_20_84_07" id="tag_20_84_07"></a>INPUT FILES</h4> 119 <blockquote> 120 <p>The file <b>/dev/tty</b> shall be used to read a single line of text for password checking, when one is required.</p> 121 </blockquote> 122 <h4 class="mansect"><a name="tag_20_84_08" id="tag_20_84_08"></a>ENVIRONMENT VARIABLES</h4> 123 <blockquote> 124 <p>The following environment variables shall affect the execution of <i>newgrp</i>:</p> 125 <dl compact> 126 <dd></dd> 127 <dt><i>LANG</i></dt> 128 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 129 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 130 variables used to determine the values of locale categories.)</dd> 131 <dt><i>LC_ALL</i></dt> 132 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 133 <dt><i>LC_CTYPE</i></dt> 134 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 135 opposed to multi-byte characters in arguments).</dd> 136 <dt><i>LC_MESSAGES</i></dt> 137 <dd><br> 138 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 139 <dt><i>NLSPATH</i></dt> 140 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 141 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 142 "0"></dd> 143 </dl> 144 </blockquote> 145 <h4 class="mansect"><a name="tag_20_84_09" id="tag_20_84_09"></a>ASYNCHRONOUS EVENTS</h4> 146 <blockquote> 147 <p>Default.</p> 148 </blockquote> 149 <h4 class="mansect"><a name="tag_20_84_10" id="tag_20_84_10"></a>STDOUT</h4> 150 <blockquote> 151 <p>Not used.</p> 152 </blockquote> 153 <h4 class="mansect"><a name="tag_20_84_11" id="tag_20_84_11"></a>STDERR</h4> 154 <blockquote> 155 <p>The standard error shall be used for diagnostic messages and a prompt string for a password, if one is required. Diagnostic 156 messages may be written in cases where the exit status is not available. See the EXIT STATUS section.</p> 157 </blockquote> 158 <h4 class="mansect"><a name="tag_20_84_12" id="tag_20_84_12"></a>OUTPUT FILES</h4> 159 <blockquote> 160 <p>None.</p> 161 </blockquote> 162 <h4 class="mansect"><a name="tag_20_84_13" id="tag_20_84_13"></a>EXTENDED DESCRIPTION</h4> 163 <blockquote> 164 <p>None.</p> 165 </blockquote> 166 <h4 class="mansect"><a name="tag_20_84_14" id="tag_20_84_14"></a>EXIT STATUS</h4> 167 <blockquote> 168 <p>If <i>newgrp</i> succeeds in creating a new shell execution environment, whether or not the group identification was changed 169 successfully, the exit status shall be the exit status of the shell. Otherwise, the following exit value shall be returned:</p> 170 <dl compact> 171 <dd></dd> 172 <dt>>0</dt> 173 <dd>An error occurred.</dd> 174 </dl> 175 </blockquote> 176 <h4 class="mansect"><a name="tag_20_84_15" id="tag_20_84_15"></a>CONSEQUENCES OF ERRORS</h4> 177 <blockquote> 178 <p>The invoking shell may terminate.</p> 179 </blockquote> 180 <hr> 181 <div class="box"><em>The following sections are informative.</em></div> 182 <h4 class="mansect"><a name="tag_20_84_16" id="tag_20_84_16"></a>APPLICATION USAGE</h4> 183 <blockquote> 184 <p>There is no convenient way to enter a password into the group database. Use of group passwords is not encouraged, because by 185 their very nature they encourage poor security practices. Group passwords may disappear in the future.</p> 186 <p>A common implementation of <i>newgrp</i> is that the current shell uses <i>exec</i> to overlay itself with <i>newgrp</i>, which 187 in turn overlays itself with a new shell after changing group. On some implementations, however, this may not occur and 188 <i>newgrp</i> may be invoked as a subprocess.</p> 189 <p>The <i>newgrp</i> command is intended only for use from an interactive terminal. It does not offer a useful interface for the 190 support of applications.</p> 191 <p>The exit status of <i>newgrp</i> is generally inapplicable. If <i>newgrp</i> is used in a script, in most cases it successfully 192 invokes a new shell and the rest of the original shell script is bypassed when the new shell exits. Used interactively, 193 <i>newgrp</i> displays diagnostic messages to indicate problems. But usage such as:</p> 194 <pre> 195 <tt>newgrp foo 196 echo $? 197 </tt></pre> 198 <p>is not useful because the new shell might not have access to any status <i>newgrp</i> may have generated (and most historical 199 systems do not provide this status). A zero status echoed here does not necessarily indicate that the user has changed to the new 200 group successfully. Following <i>newgrp</i> with the <a href="../utilities/id.html"><i>id</i></a> command provides a portable means 201 of determining whether the group change was successful or not.</p> 202 </blockquote> 203 <h4 class="mansect"><a name="tag_20_84_17" id="tag_20_84_17"></a>EXAMPLES</h4> 204 <blockquote> 205 <p>None.</p> 206 </blockquote> 207 <h4 class="mansect"><a name="tag_20_84_18" id="tag_20_84_18"></a>RATIONALE</h4> 208 <blockquote> 209 <p>Most historical implementations use one of the <i>exec</i> functions to implement the behavior of <i>newgrp</i>. Errors detected 210 before the <i>exec</i> leave the environment unchanged, while errors detected after the <i>exec</i> leave the user in a changed 211 environment. While it would be useful to have <i>newgrp</i> issue a diagnostic message to tell the user that the environment 212 changed, it would be inappropriate to require this change to some historical implementations.</p> 213 <p>The password mechanism is allowed in the group database, but how this would be implemented is not specified.</p> 214 <p>The <i>newgrp</i> utility was retained in this volume of POSIX.1-2024, even given the existence of the multiple group 215 permissions feature in the System Interfaces volume of POSIX.1-2024, for several reasons. First, in some implementations, the group 216 ownership of a newly created file is determined by the group of the directory in which the file is created, as allowed by the 217 System Interfaces volume of POSIX.1-2024; on other implementations, the group ownership of a newly created file is determined by 218 the effective group ID. On implementations of the latter type, <i>newgrp</i> allows files to be created with a specific group 219 ownership. Finally, many implementations use the real group ID in accounting, and on such systems, <i>newgrp</i> allows the 220 accounting identity of the user to be changed.</p> 221 </blockquote> 222 <h4 class="mansect"><a name="tag_20_84_19" id="tag_20_84_19"></a>FUTURE DIRECTIONS</h4> 223 <blockquote> 224 <p>None.</p> 225 </blockquote> 226 <h4 class="mansect"><a name="tag_20_84_20" id="tag_20_84_20"></a>SEE ALSO</h4> 227 <blockquote> 228 <p><a href="../utilities/V3_chap02.html#tag_19"><i>2. Shell Command Language</i></a> , <a href= 229 "../utilities/sh.html#"><i>sh</i></a></p> 230 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 231 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 232 <p>XSH <a href="../functions/exec.html#tag_17_129"><i>exec</i></a> , <a href="../functions/getgrnam.html#"><i>getgrnam</i></a></p> 233 </blockquote> 234 <h4 class="mansect"><a name="tag_20_84_21" id="tag_20_84_21"></a>CHANGE HISTORY</h4> 235 <blockquote> 236 <p>First released in Issue 2.</p> 237 </blockquote> 238 <h4 class="mansect"><a name="tag_20_84_22" id="tag_20_84_22"></a>Issue 6</h4> 239 <blockquote> 240 <p>This utility is marked as part of the User Portability Utilities option.</p> 241 <p>The obsolescent SYNOPSIS is removed.</p> 242 <p>The text describing supplemental groups is no longer conditional on {NGROUPS_MAX} being greater than 1. This is because 243 {NGROUPS_MAX} now has a minimum value of 8. This is a FIPS requirement.</p> 244 </blockquote> 245 <h4 class="mansect"><a name="tag_20_84_23" id="tag_20_84_23"></a>Issue 7</h4> 246 <blockquote> 247 <p>Austin Group Interpretation 1003.1-2001 #027 is applied, clarifying the behavior if the first argument is <tt>'-'</tt>.</p> 248 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 249 <p>The <i>newgrp</i> utility is moved from the User Portability Utilities option to the Base. User Portability Utilities is now an 250 option for interactive utilities.</p> 251 </blockquote> 252 <h4 class="mansect"><a name="tag_20_84_24" id="tag_20_84_24"></a>Issue 8</h4> 253 <blockquote> 254 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 255 </blockquote> 256 <div class="box"><em>End of informative text.</em></div> 257 <hr> 258 <p> </p> 259 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 260 <hr size="2" noshade> 261 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 262 POSIX™ is a Trademark of The IEEE.<br> 263 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 264 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 265 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 266 ]</font></center> 267 <hr size="2" noshade> 268 <div class="NAVHEADER"> 269 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 270 <tr class="nav"> 271 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mv.html" accesskey="P"><<< 272 Previous</a></td> 273 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 274 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/ngettext.html" accesskey="N">Next 275 >>></a></td> 276 </tr> 277 </table> 278 <hr align="left" width="100%"></div> 279 </body> 280 </html>