📄 chmod.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>chmod</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><xref type="10" name="chmod"></xref><h4><a name = "tag_001_014_035"> </a>NAME</h4><blockquote>chmod - change the file modes</blockquote><h4><a name = "tag_001_014_036"> </a>SYNOPSIS</h4><blockquote><pre><code>chmod <b>[</b>-R<b>] </b><i>mode file</i>...</code></pre></blockquote><h4><a name = "tag_001_014_037"> </a>DESCRIPTION</h4><blockquote>The<i>chmod</i>utility will change any or all of the file mode bits of thefile named by each<i>file</i>operand in the way specified by the<i>mode</i>operand.<p>It is implementation-dependent whether and how the<i>chmod</i>utility affectsany alternate or additional file access control mechanism (see<b>file access permissions</b>inthe <b>XBD</b> specification, <a href="../xbd/glossary.html"><b>Glossary</b> </a> )being used for the specified file.<p>Only a process whose effective user ID matches the user ID of the file,or a process with the appropriate privileges, will be permitted tochange the file mode bits of a file.</blockquote><h4><a name = "tag_001_014_038"> </a>OPTIONS</h4><blockquote>The<i>chmod</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .<p>The following option is supported:<dl compact><dt><b>-R</b><dd>Recursively change file mode bits.For each<i>file</i>operand that names a directory,<i>chmod</i>will change the file mode bits of the directory and all filesin the file hierarchy below it.</dl></blockquote><h4><a name = "tag_001_014_039"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>mode</i><dd>Represents the change to be made tothe file mode bits of each file named by one of the<i>file</i>operands; see the EXTENDED DESCRIPTION section.<dt><i>file</i><dd>A pathname of a file whose file mode bits are to be modified.</dl></blockquote><h4><a name = "tag_001_014_040"> </a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_041"> </a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_042"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>chmod</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_043"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_044"> </a>STDOUT</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_045"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_046"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_047"> </a>EXTENDED DESCRIPTION</h4><blockquote>The<i>mode</i>operand will be either a<b>symbolic_mode</b>expressionor a non-negative octal integer.The<b>symbolic_mode</b>form is described by the grammar later in this section.<p>Each<b>clause</b>will specify an operation to be performed on thecurrent file mode bits of each<i>file</i>.The operations will be performed on each<i>file</i>in the order in which the<b>clause</b>sare specified.<p>The<i>who</i>symbolsu,gandowill specify the<i>user ,</i><i>group</i>and<i>other</i>parts of the file mode bits, respectively.A<i>who</i>consisting of the symbolawill be equivalent to<b>ugo</b>.<p>The<i>perm</i>symbolsr,wandxrepresent the<i>read ,</i><i>write</i>and<i>execute/search</i>portions of file mode bits, respectively.The<i>perm</i>symbolsrepresent the<i>set-user-ID-on-execution</i>(when<b>who</b>contains or impliesu)and<i>set-group-ID-on-execution</i>(when<b>who</b>contains or impliesg)bits.<p>The<b>perm</b>symbolXrepresent the execute/search portion of the filemode bits if the file is a directory or if the current (unmodified) filemode bits have at least one of the execute bits (S_IXUSR, S_IXGRP orS_IXOTH) set.It will be ignored if the file is not a directory andnone of the execute bits are set in the current file mode bits.<p>The<b>permcopy</b>symbolsu,gandorepresent the currentpermissions associated with the user, group and other parts ofthe 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>If multiple<b>actionlist</b>sare grouped with a single<b>wholist</b>in the grammar, each<b>actionlist</b>will be applied in the order specified with that<b>wholist</b>.The<b>op</b>symbols represent the operation performed, as follows:<dl compact><dt><b>+</b><dd>If<b>perm</b>is not specified, the + operation will not change thefile mode bits.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 thosewith corresponding bits in the file mode creation mask of theinvoking process, will be set.Otherwise, the file mode bits represented by the specified<b>who</b>and<b>perm</b>values will be set.<dt><b>-</b><dd>If<b>perm</b>is not specified, the "-" operation will not change the file mode bits.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 thosewith corresponding bits in the file mode creation mask of theinvoking process, will be cleared.Otherwise, the file mode bits represented by the specified<b>who</b>and<b>perm</b>values will be cleared.<dt><b>=</b><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 inthis specification.If<b>perm</b>is not specified, the = operation will make no furthermodifications to the file mode bits.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 thosewith corresponding bits in the file mode creation mask of theinvoking process, will be set.Otherwise, the file mode bits represented by the specified<b>who</b>and<b>perm</b>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -