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