~cfuhrman/+junk/netbsd-othersrc-trunk

« back to all changes in this revision

Viewing changes to bin/fsu_chmod/fsu_chmod.1

  • Committer: stacktic
  • Date: 2009-03-23 21:04:00 UTC
  • Revision ID: svn-v4:288d5a72-fed7-e111-8680-000c29dcf8fe:trunk:1946
ImportedĀ fs-utilsĀ binaries

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\"     $NetBSD$
 
2
.\" from
 
3
.\"     NetBSD: chmod.1,v 1.21 2005/12/09 20:27:02 wiz Exp
 
4
.\"
 
5
.\" Copyright (c) 1989, 1990, 1993, 1994
 
6
.\"     The Regents of the University of California.  All rights reserved.
 
7
.\"
 
8
.\" This code is derived from software contributed to Berkeley by
 
9
.\" the Institute of Electrical and Electronics Engineers, Inc.
 
10
.\"
 
11
.\" Redistribution and use in source and binary forms, with or without
 
12
.\" modification, are permitted provided that the following conditions
 
13
.\" are met:
 
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.
 
22
.\"
 
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
 
33
.\" SUCH DAMAGE.
 
34
.\"
 
35
.\"     @(#)chmod.1     8.4 (Berkeley) 3/31/94
 
36
.\"
 
37
.Dd August 11, 2008
 
38
.Dt FSU_CHMOD 1
 
39
.Os
 
40
.Sh NAME
 
41
.Nm fsu_chmod
 
42
.Nd change file modes from a file system image through rump
 
43
.Sh SYNOPSIS
 
44
.Nm
 
45
.Op MNT_OPTIONS
 
46
.Op fstype
 
47
.Ar fsdevice
 
48
.Oo
 
49
.Fl R
 
50
.Op Fl H | Fl L | Fl P
 
51
.Oc
 
52
.Op Fl h
 
53
.Ar mode
 
54
.Ar
 
55
.Sh DESCRIPTION
 
56
The
 
57
.Nm
 
58
utility modifies the file mode bits of the listed files
 
59
as specified by the
 
60
.Ar mode
 
61
operand.
 
62
.Pp
 
63
The options are as follows:
 
64
.Bl -tag -width Ds
 
65
.It Fl H
 
66
If the
 
67
.Fl R
 
68
option is specified, symbolic links on the command line are followed.
 
69
(Symbolic links encountered in the tree traversal are not followed.)
 
70
.It Fl L
 
71
If the
 
72
.Fl R
 
73
option is specified, all symbolic links are followed.
 
74
.It Fl P
 
75
If the
 
76
.Fl R
 
77
option is specified, no symbolic links are followed.
 
78
.It Fl R
 
79
Change the modes of the file hierarchies rooted in the files
 
80
instead of just the files themselves.
 
81
.It Fl h
 
82
If
 
83
.Ar file
 
84
is symbolic link, the mode of the link is changed.
 
85
.El
 
86
.Pp
 
87
The
 
88
.Fl H ,
 
89
.Fl L
 
90
and
 
91
.Fl P
 
92
options are ignored unless the
 
93
.Fl R
 
94
option is specified.
 
95
In addition, these options override each other and the
 
96
command's actions are determined by the last one specified.
 
97
.Pp
 
98
Only the owner of a file or the super-user is permitted to change
 
99
the mode of a file.
 
100
.Sh EXIT STATUS
 
101
The
 
102
.Nm
 
103
utility exits 0 on success, and \*[Gt]0 if an error occurs.
 
104
.Sh MODES
 
105
Modes may be absolute or symbolic.
 
106
An absolute mode is an octal number constructed by
 
107
.Em or Ap ing
 
108
the following values:
 
109
.Pp
 
110
.Bl -tag -width 6n -compact -offset indent
 
111
.It Li 4000
 
112
set-user-ID-on-execution
 
113
.It Li 2000
 
114
set-group-ID-on-execution
 
115
.It Li 1000
 
116
sticky bit, see
 
117
.Xr chmod 2
 
118
.It Li 0400
 
119
read by owner
 
120
.It Li 0200
 
121
write by owner
 
122
.It Li 0100
 
123
execute (or search for directories) by owner
 
124
.It Li 0070
 
125
read, write, execute/search by group
 
126
.It Li 0007
 
127
read, write, execute/search by others
 
128
.El
 
129
.Pp
 
130
The read, write, and execute/search values for group and others
 
131
are encoded as described for owner.
 
132
.Pp
 
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
 
140
op           ::= + | \- | =
 
141
perm         ::= r | s | t | w | x | X | u | g | o
 
142
.Ed
 
143
.Pp
 
144
The
 
145
.Ar who
 
146
symbols ``u'', ``g'', and ``o'' specify the user, group, and other parts
 
147
of the mode bits, respectively.
 
148
The
 
149
.Ar who
 
150
symbol ``a'' is equivalent to ``ugo''.
 
151
.Pp
 
152
.ne 1i
 
153
The
 
154
.Ar perm
 
155
symbols represent the portions of the mode bits as follows:
 
156
.Pp
 
157
.Bl -tag -width Ds -compact -offset indent
 
158
.It r
 
159
The read bits.
 
160
.It s
 
161
The set-user-ID-on-execution and set-group-ID-on-execution bits.
 
162
.It t
 
163
The sticky bit.
 
164
.It w
 
165
The write bits.
 
166
.It x
 
167
The execute/search bits.
 
168
.It X
 
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.
 
171
Operations with the
 
172
.Ar perm
 
173
symbol ``X'' are only meaningful in conjunction with the
 
174
.Ar op
 
175
symbol ``+'', and are ignored in all other cases.
 
176
.It u
 
177
The user permission bits in the mode of the original file.
 
178
.It g
 
179
The group permission bits in the mode of the original file.
 
180
.It o
 
181
The other permission bits in the mode of the original file.
 
182
.El
 
183
.Pp
 
184
The
 
185
.Ar op
 
186
symbols represent the operation performed, as follows:
 
187
.Bl -tag -width 4n
 
188
.It +
 
189
If no value is supplied for
 
190
.Ar perm ,
 
191
the ``+'' operation has no effect.
 
192
If no value is supplied for
 
193
.Ar who ,
 
194
each permission bit specified in
 
195
.Ar perm ,
 
196
for which the corresponding bit in the file mode creation mask
 
197
is clear, is set.
 
198
Otherwise, the mode bits represented by the specified
 
199
.Ar who
 
200
and
 
201
.Ar perm
 
202
values are set.
 
203
.It \&\-
 
204
If no value is supplied for
 
205
.Ar perm ,
 
206
the ``\-'' operation has no effect.
 
207
If no value is supplied for
 
208
.Ar who ,
 
209
each permission bit specified in
 
210
.Ar perm ,
 
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
 
214
.Ar who
 
215
and
 
216
.Ar perm
 
217
values are cleared.
 
218
.It =
 
219
The mode bits specified by the
 
220
.Ar who
 
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
 
224
.Ar who ,
 
225
each permission bit specified in
 
226
.Ar perm ,
 
227
for which the corresponding bit in the file mode creation mask
 
228
is clear, is set.
 
229
Otherwise, the mode bits represented by the specified
 
230
.Ar who
 
231
and
 
232
.Ar perm
 
233
values are set.
 
234
.El
 
235
.Pp
 
236
Each
 
237
.Ar clause
 
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
 
240
order specified.
 
241
.Pp
 
242
Operations upon the other permissions only (specified by the symbol
 
243
``o'' by itself), in combination with the
 
244
.Ar perm
 
245
symbols ``s'' or ``t'', are ignored.
 
246
.Sh EXAMPLES
 
247
.Bl -tag -width "u=rwx,go=u-w" -compact
 
248
.It Li 644
 
249
make a file readable by anyone and writable by the owner only.
 
250
.Pp
 
251
.It Li go-w
 
252
deny write permission to group and others.
 
253
.Pp
 
254
.It Li =rw,+X
 
255
set the read and write permissions to the usual defaults, but
 
256
retain any execute permissions that are currently set.
 
257
.Pp
 
258
.It Li +X
 
259
make a directory or file searchable/executable by everyone if it is
 
260
already searchable/executable by anyone.
 
261
.Pp
 
262
.It Li 755
 
263
.It Li u=rwx,go=rx
 
264
.It Li u=rwx,go=u-w
 
265
make a file readable/executable by everyone and writable by the owner only.
 
266
.Pp
 
267
.It Li go=
 
268
clear all mode bits for group and others.
 
269
.Pp
 
270
.It Li g=u-w
 
271
set the group bits equal to the user bits, but clear the group write bit.
 
272
.El
 
273
.Sh SEE ALSO
 
274
.Xr chflags 1 ,
 
275
.Xr install 1 ,
 
276
.Xr chmod 2 ,
 
277
.Xr stat 2 ,
 
278
.Xr umask 2 ,
 
279
.Xr fts 3 ,
 
280
.Xr setmode 3 ,
 
281
.Xr symlink 7 ,
 
282
.Xr chown 8
 
283
.Sh STANDARDS
 
284
The
 
285
.Nm
 
286
utility is expected to be
 
287
.St -p1003.2-92
 
288
compatible with the exception of the
 
289
.Ar perm
 
290
symbol
 
291
.Dq t
 
292
which is not included in that standard.
 
293
.Sh BUGS
 
294
There's no
 
295
.Ar perm
 
296
option for the naughty bits.