638 lines
24 KiB
HTML
638 lines
24 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>chmod</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="chmod"></a> <a name="tag_04_18"></a><!-- chmod -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_18_01"></a>NAME</h4>
|
|
|
|
<blockquote>chmod - change the file modes</blockquote>
|
|
|
|
<h4><a name="tag_04_18_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>chmod</tt> <b>[</b><tt>-R</tt><b>]</b> <i>mode file</i> <tt>...</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>chmod</i> utility shall change any or all of the file mode bits of the file named by each <i>file</i> operand in the way
|
|
specified by the <i>mode</i> operand.</p>
|
|
|
|
<p>It is implementation-defined whether and how the <i>chmod</i> utility affects any alternate or additional file access control
|
|
mechanism (see the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap04.html#tag_04_04">Section 4.4, File Access Permissions</a>) being used for the specified file.</p>
|
|
|
|
<p>Only a process whose effective user ID matches the user ID of the file, or a process with the appropriate privileges, shall be
|
|
permitted to change the file mode bits of a file.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>chmod</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
|
|
|
|
<p>The following option shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-R</b></dt>
|
|
|
|
<dd>Recursively change file mode bits. For each <i>file</i> operand that names a directory, <i>chmod</i> shall change the file mode
|
|
bits of the directory and all files in the file hierarchy below it.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following operands shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>mode</i></dt>
|
|
|
|
<dd>Represents the change to be made to the file mode bits of each file named by one of the <i>file</i> operands; see the EXTENDED
|
|
DESCRIPTION section.</dd>
|
|
|
|
<dt><i>file</i></dt>
|
|
|
|
<dd>A pathname of a file whose file mode bits shall be modified.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>chmod</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard
|
|
error.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>mode</i> operand shall be either a <i>symbolic_mode</i> expression or a non-negative octal integer. The
|
|
<i>symbolic_mode</i> form is described by the grammar later in this section.</p>
|
|
|
|
<p>Each <b>clause</b> shall specify an operation to be performed on the current file mode bits of each <i>file</i>. The operations
|
|
shall be performed on each <i>file</i> in the order in which the <b>clause</b>s are specified.</p>
|
|
|
|
<p>The <b>who</b> symbols <b>u</b>, <b>g</b>, and <b>o</b> shall specify the <i>user</i>, <i>group</i>, and <i>other</i> parts of
|
|
the file mode bits, respectively. A <b>who</b> consisting of the symbol <b>a</b> shall be equivalent to <b>ugo</b>.</p>
|
|
|
|
<p>The <b>perm</b> symbols <b>r</b>, <b>w</b>, and <b>x</b> represent the <i>read</i>, <i>write</i>, and <i>execute</i>/
|
|
<i>search</i> portions of file mode bits, respectively. The <b>perm</b> symbol <b>s</b> shall represent the
|
|
<i>set-user-ID-on-execution</i> (when <b>who</b> contains or implies <b>u</b>) and <i>set-group-ID-on-execution</i> (when
|
|
<b>who</b> contains or implies <b>g</b>) bits.</p>
|
|
|
|
<p>The <b>perm</b> symbol <b>X</b> shall represent the execute/search portion of the file mode bits if the file is a directory or
|
|
if the current (unmodified) file mode bits have at least one of the execute bits (S_IXUSR, S_IXGRP, or S_IXOTH) set. It shall be
|
|
ignored if the file is not a directory and none of the execute bits are set in the current file mode bits.</p>
|
|
|
|
<p>The <b>permcopy</b> symbols <b>u</b>, <b>g</b>, and <b>o</b> shall represent the current permissions associated with the user,
|
|
group, and other parts of the file mode bits, respectively. For the remainder of this section, <b>perm</b> refers to the
|
|
non-terminals <b>perm</b> and <b>permcopy</b> in the grammar.</p>
|
|
|
|
<p>If multiple <b>actionlist</b>s are grouped with a single <b>wholist</b> in the grammar, each <b>actionlist</b> shall be applied
|
|
in the order specified with that <b>wholist</b>. The <i>op</i> symbols shall represent the operation performed, as follows:</p>
|
|
|
|
<dl compact>
|
|
<dt><tt>+</tt></dt>
|
|
|
|
<dd>If <b>perm</b> is not specified, the <tt>'+'</tt> operation shall not change the file mode bits.
|
|
|
|
<p>If <b>who</b> is not specified, the file mode bits represented by <b>perm</b> for the owner, group, and other permissions,
|
|
except for those with corresponding bits in the file mode creation mask of the invoking process, shall be set.</p>
|
|
|
|
<p>Otherwise, the file mode bits represented by the specified <b>who</b> and <b>perm</b> values shall be set.</p>
|
|
</dd>
|
|
|
|
<dt><tt>-</tt></dt>
|
|
|
|
<dd>If <b>perm</b> is not specified, the <tt>'-'</tt> operation shall not change the file mode bits.
|
|
|
|
<p>If <b>who</b> is not specified, the file mode bits represented by <b>perm</b> for the owner, group, and other permissions,
|
|
except for those with corresponding bits in the file mode creation mask of the invoking process, shall be cleared.</p>
|
|
|
|
<p>Otherwise, the file mode bits represented by the specified <b>who</b> and <b>perm</b> values shall be cleared.</p>
|
|
</dd>
|
|
|
|
<dt><tt>=</tt></dt>
|
|
|
|
<dd>Clear the file mode bits specified by the <b>who</b> value, or, if no <b>who</b> value is specified, all of the file mode bits
|
|
specified in this volume of IEEE Std 1003.1-2001.
|
|
|
|
<p>If <b>perm</b> is not specified, the <tt>'='</tt> operation shall make no further modifications to the file mode bits.</p>
|
|
|
|
<p>If <b>who</b> is not specified, the file mode bits represented by <b>perm</b> for the owner, group, and other permissions,
|
|
except for those with corresponding bits in the file mode creation mask of the invoking process, shall be set.</p>
|
|
|
|
<p>Otherwise, the file mode bits represented by the specified <b>who</b> and <b>perm</b> values shall be set.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>When using the symbolic mode form on a regular file, it is implementation-defined whether or not:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>Requests to set the set-user-ID-on-execution or set-group-ID-on-execution bit when all execute bits are currently clear and none
|
|
are being set are ignored.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Requests to clear all execute bits also clear the set-user-ID-on-execution and set-group-ID-on-execution bits.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Requests to clear the set-user-ID-on-execution or set-group-ID-on-execution bits when all execute bits are currently clear are
|
|
ignored. However, if the command <a href="../utilities/ls.html"><i>ls</i></a> <b>-l</b> <i>file</i> writes an <i>s</i> in the
|
|
position indicating that the set-user-ID-on-execution or set-group-ID-on-execution is set, the commands <i>chmod</i> <b>u-s</b>
|
|
<i>file</i> or <i>chmod</i> <b>g-s</b> <i>file</i>, respectively, shall not be ignored.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>When using the symbolic mode form on other file types, it is implementation-defined whether or not requests to set or clear the
|
|
set-user-ID-on-execution or set-group-ID-on-execution bits are honored.</p>
|
|
|
|
<p>If the <b>who</b> symbol <b>o</b> is used in conjunction with the <b>perm</b> symbol <b>s</b> with no other <b>who</b> symbols
|
|
being specified, the set-user-ID-on-execution and set-group-ID-on-execution bits shall not be modified. It shall not be an error to
|
|
specify the <b>who</b> symbol <b>o</b> in conjunction with the <b>perm</b> symbol <b>s</b>.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The <b>perm</b> symbol <b>t</b> shall specify the S_ISVTX bit and shall apply to directories only. The effect when using it with
|
|
any other file type is unspecified. It can be used with the <b>who</b> symbols <b>o</b>, <b>a</b>, or with no <b>who</b> symbol. It
|
|
shall not be an error to specify a <b>who</b> symbol of <b>u</b> or <b>g</b> in conjunction with the <b>perm</b> symbol <b>t</b>;
|
|
it shall be ignored for <b>u</b> and <b>g</b>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>For an octal integer <i>mode</i> operand, the file mode bits shall be set absolutely.</p>
|
|
|
|
<p>For each bit set in the octal number, the corresponding file permission bit shown in the following table shall be set; all other
|
|
file permission bits shall be cleared. For regular files, for each bit set in the octal number corresponding to the
|
|
set-user-ID-on-execution or the set-group-ID-on-execution, bits shown in the following table shall be set; if these bits are not
|
|
set in the octal number, they are cleared. For other file types, it is implementation-defined whether or not requests to set or
|
|
clear the set-user-ID-on-execution or set-group-ID-on-execution bits are honored.</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Octal</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Mode Bit</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Octal</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Mode Bit</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Octal</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Mode Bit</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Octal</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Mode Bit</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>4000</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_ISUID</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0400</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IRUSR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0040</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IRGRP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0004</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IROTH</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>2000</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_ISGID</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0200</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IWUSR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0020</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IWGRP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0002</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IWOTH</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b><img src="../images/opt-start.gif" border="0">1000</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_ISVTX<img src="../images/opt-end.gif" border="0"></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0100</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IXUSR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0010</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IXGRP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>0001</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">S_IXOTH</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>When bits are set in the octal number other than those listed in the table above, the behavior is unspecified.</p>
|
|
|
|
<h5><a name="tag_04_18_13_01"></a>Grammar for chmod</h5>
|
|
|
|
<p>The grammar and lexical conventions in this section describe the syntax for the <i>symbolic_mode</i> operand. The general
|
|
conventions for this style of grammar are described in <a href="xcu_chap01.html#tag_01_10"><i>Grammar Conventions</i></a> . A valid
|
|
<i>symbolic_mode</i> can be represented as the non-terminal symbol <i>symbolic_mode</i> in the grammar. This formal syntax shall
|
|
take precedence over the preceding text syntax description.</p>
|
|
|
|
<p>The lexical processing is based entirely on single characters. Implementations need not allow <blank>s within the single
|
|
argument being processed.</p>
|
|
|
|
<pre>
|
|
<tt>%start symbolic_mode
|
|
%%
|
|
<br>
|
|
symbolic_mode : clause
|
|
| symbolic_mode ',' clause
|
|
;
|
|
<br>
|
|
clause : actionlist
|
|
| wholist actionlist
|
|
;
|
|
<br>
|
|
wholist : who
|
|
| wholist who
|
|
;
|
|
<br>
|
|
who : 'u' | 'g' | 'o' | 'a'
|
|
;
|
|
<br>
|
|
actionlist : action
|
|
| actionlist action
|
|
;
|
|
<br>
|
|
action : op
|
|
| op permlist
|
|
| op permcopy
|
|
;
|
|
<br>
|
|
permcopy : 'u' | 'g' | 'o'
|
|
;
|
|
<br>
|
|
op : '+' | '-' | '='
|
|
;
|
|
<br>
|
|
permlist : perm
|
|
| perm permlist
|
|
;
|
|
<br>
|
|
<sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup>
|
|
perm : 'r' | 'w' | 'x' | 'X' | 's' |<img src="../images/opt-start.gif" border="0"> 't' <img src=
|
|
"../images/opt-end.gif" border="0">
|
|
;
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>The utility executed successfully and all requested changes were made.</dd>
|
|
|
|
<dt>>0</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_18_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>Some implementations of the <i>chmod</i> utility change the mode of a directory before the files in the directory when
|
|
performing a recursive ( <b>-R</b> option) change; others change the directory mode after the files in the directory. If an
|
|
application tries to remove read or search permission for a file hierarchy, the removal attempt fails if the directory is changed
|
|
first; on the other hand, trying to re-enable permissions to a restricted hierarchy fails if directories are changed last. Users
|
|
should not try to make a hierarchy inaccessible to themselves.</p>
|
|
|
|
<p>Some implementations of <i>chmod</i> never used the process' <a href="../utilities/umask.html"><i>umask</i></a> when changing
|
|
modes; systems conformant with this volume of IEEE Std 1003.1-2001 do so when <b>who</b> is not specified. Note the
|
|
difference between:</p>
|
|
|
|
<pre>
|
|
<tt>chmod a-w file
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>which removes all write permissions, and:</p>
|
|
|
|
<pre>
|
|
<tt>chmod -- -w file
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>which removes write permissions that would be allowed if <b>file</b> was created with the same <a href=
|
|
"../utilities/umask.html"><i>umask</i></a>.</p>
|
|
|
|
<p>Conforming applications should never assume that they know how the set-user-ID and set-group-ID bits on directories are
|
|
interpreted.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mode</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Results</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>a</i>+=</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Equivalent to <i>a</i>+, <i>a</i>=; clears all file mode bits.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>go</i>+-w</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Equivalent to <i>go</i>+, <i>go</i>- <i>w</i>; clears group and other write bits.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>g</i>=<i>o</i>-<i>w</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Equivalent to <i>g</i>= <i>o</i>, <i>g</i>- <i>w</i>; sets group bit to match other bits and then clears group
|
|
write bit.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>g</i>-<i>r</i>+<i>w</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Equivalent to <i>g</i>- <i>r</i>, <i>g</i>+ <i>w</i>; clears group read bit and sets group write bit.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>uo</i>=<i>g</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Sets owner bits to match group bits and sets other bits to match group bits.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The functionality of <i>chmod</i> is described substantially through references to concepts defined in the System Interfaces
|
|
volume of IEEE Std 1003.1-2001. In this way, there is less duplication of effort required for describing the interactions
|
|
of permissions. However, the behavior of this utility is not described in terms of the <a href=
|
|
"../functions/chmod.html"><i>chmod</i>()</a> function from the System Interfaces volume of IEEE Std 1003.1-2001 because
|
|
that specification requires certain side effects upon alternate file access control mechanisms that might not be appropriate,
|
|
depending on the implementation.</p>
|
|
|
|
<p>Implementations that support mandatory file and record locking as specified by the 1984 /usr/group standard historically used
|
|
the combination of set-group-ID bit set and group execute bit clear to indicate mandatory locking. This condition is usually set or
|
|
cleared with the symbolic mode <b>perm</b> symbol <b>l</b> instead of the <b>perm</b> symbols <b>s</b> and <b>x</b> so that the
|
|
mandatory locking mode is not changed without explicit indication that that was what the user intended. Therefore, the details on
|
|
how the implementation treats these conditions must be defined in the documentation. This volume of IEEE Std 1003.1-2001
|
|
does not require mandatory locking (nor does the System Interfaces volume of IEEE Std 1003.1-2001), but does allow it as
|
|
an extension. However, this volume of IEEE Std 1003.1-2001 does require that the <a href=
|
|
"../utilities/ls.html"><i>ls</i></a> and <i>chmod</i> utilities work consistently in this area. If <a href=
|
|
"../utilities/ls.html"><i>ls</i></a> <b>-l</b> <i>file</i> indicates that the set-group-ID bit is set, <i>chmod</i> <b>g-s</b>
|
|
<i>file</i> must clear it (assuming appropriate privileges exist to change modes).</p>
|
|
|
|
<p>The System V and BSD versions use different exit status codes. Some implementations used the exit status as a count of the
|
|
number of errors that occurred; this practice is unworkable since it can overflow the range of valid exit status values. This
|
|
problem is avoided here by specifying only 0 and >0 as exit values.</p>
|
|
|
|
<p>The System Interfaces volume of IEEE Std 1003.1-2001 indicates that implementation-defined restrictions may cause the
|
|
S_ISUID and S_ISGID bits to be ignored. This volume of IEEE Std 1003.1-2001 allows the <i>chmod</i> utility to choose to
|
|
modify these bits before calling <a href="../functions/chmod.html"><i>chmod</i>()</a> (or some function providing equivalent
|
|
capabilities) for non-regular files. Among other things, this allows implementations that use the set-user-ID and set-group-ID bits
|
|
on directories to enable extended features to handle these extensions in an intelligent manner.</p>
|
|
|
|
<p>The <b>X</b> <b>perm</b> symbol was adopted from BSD-based systems because it provides commonly desired functionality when doing
|
|
recursive ( <b>-R</b> option) modifications. Similar functionality is not provided by the <a href=
|
|
"../utilities/find.html"><i>find</i></a> utility. Historical BSD versions of <i>chmod</i>, however, only supported <b>X</b> with
|
|
<i>op</i>+; it has been extended in this volume of IEEE Std 1003.1-2001 because it is also useful with <i>op</i>=. (It
|
|
has also been added for <i>op</i>- even though it duplicates <b>x</b>, in this case, because it is intuitive and easier to
|
|
explain.)</p>
|
|
|
|
<p>The grammar was extended with the <i>permcopy</i> non-terminal to allow historical-practice forms of symbolic modes like
|
|
<b>o</b>= <b>u</b> <b>-g</b> (that is, set the "other" permissions to the permissions of "owner" minus the permissions of
|
|
"group").</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="ls.html"><i>ls</i></a> , <a href="umask.html"><i>umask</i></a> , the System Interfaces volume of
|
|
IEEE Std 1003.1-2001, <a href="../functions/chmod.html"><i>chmod</i>()</a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_18_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>Octal modes have been kept and made mandatory despite being marked obsolescent in the ISO POSIX-2:1993 standard.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>IEEE PASC Interpretation 1003.2 #172 is applied, changing the CONSEQUENCES OF ERRORS section to "Default.".</p>
|
|
|
|
<p>The Open Group Base Resolution bwg2001-010 is applied, adding the description of the S_ISVTX bit and the <b>t perm</b>
|
|
symbol as an XSI extension.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|