]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - bin/chflags/chflags.1
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / bin / chflags / chflags.1
1 .\"-
2 .\" Copyright (c) 1989, 1990, 1993, 1994
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\"
5 .\" This code is derived from software contributed to Berkeley by
6 .\" the Institute of Electrical and Electronics Engineers, Inc.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)chflags.1   8.4 (Berkeley) 5/2/95
33 .\" $FreeBSD$
34 .\"
35 .Dd March 3, 2006
36 .Dt CHFLAGS 1
37 .Os
38 .Sh NAME
39 .Nm chflags
40 .Nd change file flags
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl fhv
44 .Oo
45 .Fl R
46 .Op Fl H | Fl L | Fl P
47 .Oc
48 .Ar flags
49 .Ar
50 .Sh DESCRIPTION
51 The
52 .Nm
53 utility modifies the file flags of the listed files
54 as specified by the
55 .Ar flags
56 operand.
57 .Pp
58 The options are as follows:
59 .Bl -tag -width indent
60 .It Fl f
61 Do not display a diagnostic message if
62 .Nm
63 could not modify the flags for
64 .Va file ,
65 nor modify the exit status to reflect such failures.
66 .It Fl H
67 If the
68 .Fl R
69 option is specified, symbolic links on the command line are followed.
70 (Symbolic links encountered in the tree traversal are not followed.)
71 .It Fl h
72 If the
73 .Ar file
74 is a symbolic link,
75 change the file flags of the link itself rather than the file to which it points.
76 .It Fl L
77 If the
78 .Fl R
79 option is specified, all symbolic links are followed.
80 .It Fl P
81 If the
82 .Fl R
83 option is specified, no symbolic links are followed.
84 This is the default.
85 .It Fl R
86 Change the file flags for the file hierarchies rooted
87 in the files instead of just the files themselves.
88 .It Fl v
89 Cause
90 .Nm
91 to be verbose, showing filenames as the flags are modified.
92 If the
93 .Fl v
94 option is specified more than once, the old and new flags of the file
95 will also be printed, in octal notation.
96 .El
97 .Pp
98 The flags are specified as an octal number or a comma separated list
99 of keywords.
100 The following keywords are currently defined:
101 .Pp
102 .Bl -tag -offset indent -width ".Cm opaque"
103 .It Cm arch , archived
104 set the archived flag (super-user only)
105 .It Cm opaque
106 set the opaque flag (owner or super-user only)
107 .It Cm nodump
108 set the nodump flag (owner or super-user only)
109 .It Cm sappnd , sappend
110 set the system append-only flag (super-user only)
111 .It Cm schg , schange , simmutable
112 set the system immutable flag (super-user only)
113 .It Cm sunlnk , sunlink
114 set the system undeletable flag (super-user only)
115 .It Cm uappnd , uappend
116 set the user append-only flag (owner or super-user only)
117 .It Cm uchg , uchange , uimmutable
118 set the user immutable flag (owner or super-user only)
119 .It Cm uunlnk , uunlink
120 set the user undeletable flag (owner or super-user only)
121 .El
122 .Pp
123 Putting the letters
124 .Dq Ar no
125 before or removing the letters
126 .Dq Ar no
127 from a keyword causes the flag to be cleared.
128 For example:
129 .Pp
130 .Bl -tag -offset indent -width "nouchg" -compact
131 .It Cm nouchg
132 clear the user immutable flag (owner or super-user only)
133 .It Cm dump
134 clear the nodump flag (owner or super-user only)
135 .El
136 .Pp
137 A few of the octal values include:
138 .Bl -tag -offset indent -width ".Li 10"
139 .It Li 0
140 Clear all file flags.
141 .It Li 1
142 Translates to the
143 .Cm nodump
144 keyword.
145 .It Li 2
146 Translates to the
147 .Cm uchg
148 keyword.
149 .It Li 3
150 Translates to the
151 .Cm uchg , nodump
152 keywords.
153 .It Li 4
154 Translates to the
155 .Cm uappnd
156 keyword.
157 .It Li 10
158 Translates to the
159 .Cm opaque
160 keyword.
161 .It Li 20
162 translates to the
163 .Cm uunlnk
164 keyword.
165 .El
166 .Pp
167 Other combinations of keywords may be placed by using
168 the octets assigned; however, these are the most notable.
169 .Pp
170 Unless the
171 .Fl H ,
172 .Fl L ,
173 or
174 .Fl h
175 options are given,
176 .Nm
177 on a symbolic link always succeeds and has no effect.
178 The
179 .Fl H ,
180 .Fl L
181 and
182 .Fl P
183 options are ignored unless the
184 .Fl R
185 option is specified.
186 In addition, these options override each other and the
187 command's actions are determined by the last one specified.
188 .Pp
189 You can use "ls -lo" to see the flags of existing files.
190 .Pp
191 Note that the ability to change certain flags is dependent
192 on the current kernel
193 .Va securelevel
194 setting.
195 See
196 .Xr security 7
197 for more information on this setting.
198 .Sh EXIT STATUS
199 .Ex -std
200 .Sh SEE ALSO
201 .Xr ls 1 ,
202 .Xr chflags 2 ,
203 .Xr stat 2 ,
204 .Xr fts 3 ,
205 .Xr security 7 ,
206 .Xr symlink 7
207 .Sh HISTORY
208 The
209 .Nm
210 command first appeared in
211 .Bx 4.4 .
212 .Sh BUGS
213 Only a limited number of utilities are
214 .Nm
215 aware.
216 Some of these tools include
217 .Xr ls 1 ,
218 .Xr cp 1 ,
219 .Xr find 1 ,
220 .Xr install 1 ,
221 .Xr dump 8 ,
222 and
223 .Xr restore 8 .
224 In particular a tool which is not currently
225 .Nm
226 aware is the
227 .Xr pax 1
228 utility.