You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

chmod.html 5.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Chmod Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="chmod">Chmod</a></h2>
  8. <h3>Description</h3>
  9. <p>Changes the permissions of a file or all files inside specified
  10. directories. Right now it has effect only under Unix or NonStop Kernel (Tandem).
  11. The permissions are also UNIX style, like the argument for the chmod command.</p>
  12. <p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based
  13. tasks</a>, on how the inclusion/exclusion of files works, and how to
  14. write patterns.</p>
  15. <p>This task holds an implicit <a
  16. href="../CoreTypes/fileset.html">FileSet</a> and supports all of
  17. FileSet's attributes and nested elements directly. More sets can be
  18. specified using nested <code>&lt;fileset&gt;</code> or
  19. <code>&lt;dirset&gt;</code> (<em>since Ant 1.6</em>) elements. </p>
  20. <p>Starting with Ant 1.6, this task also supports nested <a
  21. href="../CoreTypes/filelist.html">filelist</a>s.</p>
  22. <h3>Parameters</h3>
  23. <table border="1" cellpadding="2" cellspacing="0">
  24. <tr>
  25. <td valign="top"><b>Attribute</b></td>
  26. <td valign="top"><b>Description</b></td>
  27. <td align="center" valign="top"><b>Required</b></td>
  28. </tr>
  29. <tr>
  30. <td valign="top">file</td>
  31. <td valign="top">the file or single directory of which the permissions
  32. must be changed.</td>
  33. <td valign="top" valign="middle" rowspan="2">exactly one of the two or nested <code>&lt;fileset/list&gt;</code> elements.</td>
  34. </tr>
  35. <tr>
  36. <td valign="top">dir</td>
  37. <td valign="top">the directory which holds the files whose permissions
  38. must be changed.</td>
  39. </tr>
  40. <tr>
  41. <td valign="top">perm</td>
  42. <td valign="top">the new permissions.</td>
  43. <td valign="top" align="center">Yes</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">includes</td>
  47. <td valign="top">comma- or space-separated list of patterns of files that must be
  48. included.</td>
  49. <td valign="top" align="center">No</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">excludes</td>
  53. <td valign="top">comma- or space-separated list of patterns of files that must be
  54. excluded. No files (except default excludes) are excluded when omitted.</td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. <tr>
  58. <td valign="top">defaultexcludes</td>
  59. <td valign="top">indicates whether default excludes should be used or not
  60. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  61. <td valign="top" align="center">No</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">parallel</td>
  65. <td valign="top">process all specified files using a single
  66. <code>chmod</code> command. Defaults to true.</td>
  67. <td valign="top" align="center">No</td>
  68. </tr>
  69. <tr>
  70. <td valign="top">type</td>
  71. <td valign="top">One of <i>file</i>, <i>dir</i> or
  72. <i>both</i>. If set to <i>file</i>, only the permissions of
  73. plain files are going to be changed. If set to <i>dir</i>, only
  74. the directories are considered.<br>
  75. <strong>Note:</strong> The type attribute does not apply to
  76. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  77. assume type to be <i>dir</i>.</td>
  78. <td align="center" valign="top">No, default is <i>file</i></td>
  79. </tr>
  80. <tr>
  81. <td valign="top">maxparallel</td>
  82. <td valign="top">Limit the amount of parallelism by passing at
  83. most this many sourcefiles at once. Set it to &lt;= 0 for
  84. unlimited. Defaults to unlimited. <em>Since Ant 1.6.</em></td>
  85. <td align="center" valign="top">No</td>
  86. </tr>
  87. <tr>
  88. <td valign="top">verbose</td>
  89. <td valign="top">Whether to print a summary after execution or not.
  90. Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td>
  91. <td align="center" valign="top">No</td>
  92. </tr>
  93. </table>
  94. <h3>Examples</h3>
  95. <blockquote>
  96. <p><code>&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;/&gt;</code></p>
  97. </blockquote>
  98. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  99. UNIX system.</p>
  100. <blockquote>
  101. <p><code>&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;700&quot;/&gt;</code></p>
  102. </blockquote>
  103. <p>makes the &quot;start.sh&quot; file readable, writable and executable only for the owner on a
  104. UNIX system.</p>
  105. <blockquote>
  106. <pre>
  107. &lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot;
  108. includes=&quot;**/*.sh&quot;/&gt;
  109. </pre>
  110. </blockquote>
  111. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  112. readable and executable for anyone on a UNIX system.</p>
  113. <blockquote>
  114. <pre>
  115. &lt;chmod perm=&quot;g+w&quot;&gt;
  116. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  117. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  118. &lt;/fileset&gt;
  119. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  120. &lt;/chmod&gt;
  121. </pre>
  122. </blockquote>
  123. <p>makes all files below <code>shared/sources1</code> (except those
  124. below any directory named trial) writable for members of the same
  125. group on a UNIX system. In addition all files belonging to a FileSet
  126. with <code>id</code> <code>other.shared.sources</code> get the same
  127. permissions.</p>
  128. <blockquote>
  129. <pre>
  130. &lt;chmod perm=&quot;go-rwx&quot; type=&quot;file&quot;&gt;
  131. &lt;fileset dir=&quot;/web&quot;&gt;
  132. &lt;include name=&quot;**/*.cgi&quot;/&gt;
  133. &lt;include name=&quot;**/*.old&quot;/&gt;
  134. &lt;/fileset&gt;
  135. &lt;dirset dir=&quot;/web&quot;&gt;
  136. &lt;include name=&quot;**/private_*&quot;/&gt;
  137. &lt;/dirset&gt;
  138. &lt;/chmod&gt;
  139. </pre>
  140. </blockquote>
  141. <p>keeps non-owners from touching cgi scripts, files with a <code>.old</code>
  142. extension or directories begining with <code>private_</code>. A directory
  143. ending in <code>.old</code> or a file begining with private_ would remain
  144. unaffected.</p>
  145. <hr>
  146. <p align="center">Copyright &copy; 2000-2003 Apache Software Foundation.
  147. All rights Reserved.</p>
  148. </body>
  149. </html>