1 .\" $NetBSD: chmod.1,v 1.11 1997/10/20 08:51:10 enami Exp $
3 .\" Copyright (c) 1989, 1990, 1993, 1994
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\" must display the following acknowledgement:
19 .\" This product includes software developed by the University of
20 .\" California, Berkeley and its contributors.
21 .\" 4. Neither the name of the University nor the names of its contributors
22 .\" may be used to endorse or promote products derived from this software
23 .\" without specific prior written permission.
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
49 .Op Fl H | Fl L | Fl P
57 utility modifies the file mode bits of the listed files
62 The options are as follows:
67 option is specified, symbolic links on the command line are followed.
68 (Symbolic links encountered in the tree traversal are not followed.)
72 option is specified, all symbolic links are followed.
76 option is specified, no symbolic links are followed.
78 Change the modes of the file hierarchies rooted in the files
79 instead of just the files themselves.
83 .\" is symbolic link, the mode of the link is changed.
95 on a symbolic link always succeeds and has no effect.
101 options are ignored unless the
104 In addition, these options override each other and the
105 command's actions are determined by the last one specified.
107 Only the owner of a file or the super-user is permitted to change
112 utility exits 0 on success, and >0 if an error occurs.
114 Modes may be absolute or symbolic.
115 An absolute mode is an octal number constructed by
117 the following values:
119 .Bl -tag -width 6n -compact -offset indent
121 set-user-ID-on-execution
123 set-group-ID-on-execution
132 execute (or search for directories) by owner
134 read, write, execute/search by group
136 read, write, execute/search by others
139 The read, write, and execute/search values for group and others
140 are encoded as described for owner.
142 The symbolic mode is described by the following grammar:
143 .Bd -literal -offset indent
144 mode ::= clause [, clause ...]
145 clause ::= [who ...] [action ...] last_action
146 action ::= op [perm ...]
147 last_action ::= op [perm ...]
148 who ::= a | u | g | o
150 perm ::= r | s | t | w | x | X | u | g | o
155 symbols ``u'', ``g'', and ``o'' specify the user, group, and other parts
156 of the mode bits, respectively.
159 symbol ``a'' is equivalent to ``ugo''.
164 symbols represent the portions of the mode bits as follows:
166 .Bl -tag -width Ds -compact -offset indent
170 The set-user-ID-on-execution and set-group-ID-on-execution bits.
176 The execute/search bits.
178 The execute/search bits if the file is a directory or any of the
179 execute/search bits are set in the original (unmodified) mode.
182 symbol ``X'' are only meaningful in conjunction with the
184 symbol ``+'', and are ignored in all other cases.
186 The user permission bits in the mode of the original file.
188 The group permission bits in the mode of the original file.
190 The other permission bits in the mode of the original file.
195 symbols represent the operation performed, as follows:
198 If no value is supplied for
200 the ``+'' operation has no effect.
201 If no value is supplied for
203 each permission bit specified in
205 for which the corresponding bit in the file mode creation mask
207 Otherwise, the mode bits represented by the specified
213 If no value is supplied for
215 the ``\-'' operation has no effect.
216 If no value is supplied for
218 each permission bit specified in
220 for which the corresponding bit in the file mode creation mask
221 is clear, is cleared.
222 Otherwise, the mode bits represented by the specified
228 The mode bits specified by the
230 value are cleared, or, if no who value is specified, the owner, group
231 and other mode bits are cleared.
232 Then, if no value is supplied for
234 each permission bit specified in
236 for which the corresponding bit in the file mode creation mask
238 Otherwise, the mode bits represented by the specified
247 specifies one or more operations to be performed on the mode
248 bits, and each operation is applied to the mode bits in the
251 Operations upon the other permissions only (specified by the symbol
252 ``o'' by itself), in combination with the
254 symbols ``s'' or ``t'', are ignored.
256 .Bl -tag -width "u=rwx,go=u-w" -compact
258 make a file readable by anyone and writable by the owner only.
261 deny write permission to group and others.
264 set the read and write permissions to the usual defaults, but
265 retain any execute permissions that are currently set.
268 make a directory or file searchable/executable by everyone if it is
269 already searchable/executable by anyone.
274 make a file readable/executable by everyone and writable by the owner only.
277 clear all mode bits for group and others.
280 set the group bits equal to the user bits, but clear the group write bit.
285 option for the naughty bits.
298 utility is expected to be
300 compatible with the exception of the
306 which are not included in that standard.