3
.\" NetBSD: chmod.1,v 1.21 2005/12/09 20:27:02 wiz Exp
5
.\" Copyright (c) 1989, 1990, 1993, 1994
6
.\" The Regents of the University of California. All rights reserved.
8
.\" This code is derived from software contributed to Berkeley by
9
.\" the Institute of Electrical and Electronics Engineers, Inc.
11
.\" Redistribution and use in source and binary forms, with or without
12
.\" modification, are permitted provided that the following conditions
14
.\" 1. Redistributions of source code must retain the above copyright
15
.\" notice, this list of conditions and the following disclaimer.
16
.\" 2. Redistributions in binary form must reproduce the above copyright
17
.\" notice, this list of conditions and the following disclaimer in the
18
.\" documentation and/or other materials provided with the distribution.
19
.\" 3. Neither the name of the University nor the names of its contributors
20
.\" may be used to endorse or promote products derived from this software
21
.\" without specific prior written permission.
23
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
42
.Nd change file modes from a file system image through rump
50
.Op Fl H | Fl L | Fl P
58
utility modifies the file mode bits of the listed files
63
The options are as follows:
68
option is specified, symbolic links on the command line are followed.
69
(Symbolic links encountered in the tree traversal are not followed.)
73
option is specified, all symbolic links are followed.
77
option is specified, no symbolic links are followed.
79
Change the modes of the file hierarchies rooted in the files
80
instead of just the files themselves.
84
is symbolic link, the mode of the link is changed.
92
options are ignored unless the
95
In addition, these options override each other and the
96
command's actions are determined by the last one specified.
98
Only the owner of a file or the super-user is permitted to change
103
utility exits 0 on success, and \*[Gt]0 if an error occurs.
105
Modes may be absolute or symbolic.
106
An absolute mode is an octal number constructed by
108
the following values:
110
.Bl -tag -width 6n -compact -offset indent
112
set-user-ID-on-execution
114
set-group-ID-on-execution
123
execute (or search for directories) by owner
125
read, write, execute/search by group
127
read, write, execute/search by others
130
The read, write, and execute/search values for group and others
131
are encoded as described for owner.
133
The symbolic mode is described by the following grammar:
134
.Bd -literal -offset indent
135
mode ::= clause [, clause ...]
136
clause ::= [who ...] [action ...] last_action
137
action ::= op [perm ...]
138
last_action ::= op [perm ...]
139
who ::= a | u | g | o
141
perm ::= r | s | t | w | x | X | u | g | o
146
symbols ``u'', ``g'', and ``o'' specify the user, group, and other parts
147
of the mode bits, respectively.
150
symbol ``a'' is equivalent to ``ugo''.
155
symbols represent the portions of the mode bits as follows:
157
.Bl -tag -width Ds -compact -offset indent
161
The set-user-ID-on-execution and set-group-ID-on-execution bits.
167
The execute/search bits.
169
The execute/search bits if the file is a directory or any of the
170
execute/search bits are set in the original (unmodified) mode.
173
symbol ``X'' are only meaningful in conjunction with the
175
symbol ``+'', and are ignored in all other cases.
177
The user permission bits in the mode of the original file.
179
The group permission bits in the mode of the original file.
181
The other permission bits in the mode of the original file.
186
symbols represent the operation performed, as follows:
189
If no value is supplied for
191
the ``+'' operation has no effect.
192
If no value is supplied for
194
each permission bit specified in
196
for which the corresponding bit in the file mode creation mask
198
Otherwise, the mode bits represented by the specified
204
If no value is supplied for
206
the ``\-'' operation has no effect.
207
If no value is supplied for
209
each permission bit specified in
211
for which the corresponding bit in the file mode creation mask
212
is clear, is cleared.
213
Otherwise, the mode bits represented by the specified
219
The mode bits specified by the
221
value are cleared, or, if no who value is specified, the owner, group
222
and other mode bits are cleared.
223
Then, if no value is supplied for
225
each permission bit specified in
227
for which the corresponding bit in the file mode creation mask
229
Otherwise, the mode bits represented by the specified
238
specifies one or more operations to be performed on the mode
239
bits, and each operation is applied to the mode bits in the
242
Operations upon the other permissions only (specified by the symbol
243
``o'' by itself), in combination with the
245
symbols ``s'' or ``t'', are ignored.
247
.Bl -tag -width "u=rwx,go=u-w" -compact
249
make a file readable by anyone and writable by the owner only.
252
deny write permission to group and others.
255
set the read and write permissions to the usual defaults, but
256
retain any execute permissions that are currently set.
259
make a directory or file searchable/executable by everyone if it is
260
already searchable/executable by anyone.
265
make a file readable/executable by everyone and writable by the owner only.
268
clear all mode bits for group and others.
271
set the group bits equal to the user bits, but clear the group write bit.
286
utility is expected to be
288
compatible with the exception of the
292
which is not included in that standard.
296
option for the naughty bits.