source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/manual/CoreTasks/chmod.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

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