⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chmod.html

📁 posix标准英文,html格式
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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-2004 IEEE and 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, 2004 Edition<br>Copyright &copy; 2001-2004 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 wayspecified 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 controlmechanism (see the Base Definitions volume of IEEE&nbsp;Std&nbsp;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 bepermitted 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&nbsp;Std&nbsp;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 modebits 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 EXTENDEDDESCRIPTION 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 ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe 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 asopposed 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 standarderror.</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 operationsshall 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 ofthe 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 orif the current (unmodified) file mode bits have at least one of the execute bits (S_IXUSR, S_IXGRP, or S_IXOTH) set. It shall beignored 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 thenon-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 appliedin 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 bitsspecified in this volume of IEEE&nbsp;Std&nbsp;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 noneare 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 areignored. 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 theposition 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 theset-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> symbolsbeing specified, the set-user-ID-on-execution and set-group-ID-on-execution bits shall not be modified. It shall not be an error tospecify 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. When used with a file of type directory, it can be used with the<b>who</b> symbol <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>,<b>g</b>, or <b>o</b> in conjunction with the <b>perm</b> symbol <b>t</b>, but the meaning of these combinations is unspecified.The effect when using the <b>perm</b> symbol <b>t</b> with any file type other than directory is unspecified. <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 otherfile permission bits shall be cleared. For regular files, for each bit set in the octal number corresponding to theset-user-ID-on-execution or the set-group-ID-on-execution, bits shown in the following table shall be set; if these bits are notset in the octal number, they are cleared. For other file types, it is implementation-defined whether or not requests to set orclear 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -