]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - bin/chflags/chflags.1
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 April 20, 2015
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 and hence unaffected by the command.
71 (Symbolic links encountered during traversal are not followed.)
72 .It Fl h
73 If the
74 .Ar file
75 is a symbolic link,
76 change the file flags of the link itself rather than the file to which it points.
77 .It Fl L
78 If the
79 .Fl R
80 option is specified, all symbolic links are followed.
81 .It Fl P
82 If the
83 .Fl R
84 option is specified, no symbolic links are followed.
85 This is the default.
86 .It Fl R
87 Change the file flags of the file hierarchies rooted in the files,
88 instead of just the files themselves.
89 Beware of unintentionally matching the
90 .Dq Pa ".."
91 hard link to the parent directory when using wildcards like
92 .Dq Li ".*" .
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 opaque"
107 .It Cm arch , archived
108 set the archived flag (super-user only)
109 .It Cm nodump
110 set the nodump flag (owner or super-user only)
111 .It Cm opaque
112 set the opaque flag (owner or super-user only)
113 .It Cm sappnd , sappend
114 set the system append-only flag (super-user only)
115 .It Cm schg , schange , simmutable
116 set the system immutable flag (super-user only)
117 .It Cm snapshot
118 set the snapshot flag (filesystems do not allow changing this flag)
119 .It Cm sunlnk , sunlink
120 set the system undeletable flag (super-user only)
121 .It Cm uappnd , uappend
122 set the user append-only flag (owner or super-user only)
123 .It Cm uarch , uarchive
124 set the archive 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 uhidden , hidden
128 set the hidden file attribute (owner or super-user only)
129 .It Cm uoffline , offline
130 set the offline file attribute (owner or super-user only)
131 .It Cm urdonly , rdonly , readonly
132 set the DOS, Windows and CIFS readonly flag (owner or super-user only)
133 .It Cm usparse , sparse
134 set the sparse file attribute (owner or super-user only)
135 .It Cm usystem , system
136 set the DOS, Windows and CIFS system flag (owner or super-user only)
137 .It Cm ureparse , reparse
138 set the Windows reparse point file attribute (owner or super-user only)
139 .It Cm uunlnk , uunlink
140 set the user undeletable flag (owner or super-user only)
141 .El
142 .Pp
143 Putting the letters
144 .Dq Ar no
145 before or removing the letters
146 .Dq Ar no
147 from a keyword causes the flag to be cleared.
148 For example:
149 .Pp
150 .Bl -tag -offset indent -width "nouchg" -compact
151 .It Cm nouchg
152 clear the user immutable flag (owner or super-user only)
153 .It Cm dump
154 clear the nodump flag (owner or super-user only)
155 .El
156 .Pp
157 A few of the octal values include:
158 .Bl -tag -offset indent -width ".Li 10"
159 .It Li 0
160 Clear all file flags.
161 .It Li 1
162 Translates to the
163 .Cm nodump
164 keyword.
165 .It Li 2
166 Translates to the
167 .Cm uchg
168 keyword.
169 .It Li 3
170 Translates to the
171 .Cm uchg , nodump
172 keywords.
173 .It Li 4
174 Translates to the
175 .Cm uappnd
176 keyword.
177 .It Li 10
178 Translates to the
179 .Cm opaque
180 keyword.
181 .It Li 20
182 translates to the
183 .Cm uunlnk
184 keyword.
185 .El
186 .Pp
187 Other combinations of keywords may be placed by using
188 the octets assigned; however, these are the most notable.
189 .Pp
190 Unless the
191 .Fl H ,
192 .Fl L ,
193 or
194 .Fl h
195 options are given,
196 .Nm
197 on a symbolic link always succeeds and has no effect.
198 The
199 .Fl H ,
200 .Fl L
201 and
202 .Fl P
203 options are ignored unless the
204 .Fl R
205 option is specified.
206 In addition, these options override each other and the
207 command's actions are determined by the last one specified.
208 .Pp
209 You can use "ls -lo" to see the flags of existing files.
210 .Pp
211 Note that the ability to change certain flags is dependent
212 on the current kernel
213 .Va securelevel
214 setting.
215 See
216 .Xr security 7
217 for more information on this setting.
218 .Sh EXIT STATUS
219 .Ex -std
220 .Sh SEE ALSO
221 .Xr ls 1 ,
222 .Xr chflags 2 ,
223 .Xr stat 2 ,
224 .Xr fts 3 ,
225 .Xr security 7 ,
226 .Xr symlink 7
227 .Sh HISTORY
228 The
229 .Nm
230 command first appeared in
231 .Bx 4.4 .
232 .Sh BUGS
233 Only a limited number of utilities are
234 .Nm
235 aware.
236 Some of these tools include
237 .Xr ls 1 ,
238 .Xr cp 1 ,
239 .Xr find 1 ,
240 .Xr install 1 ,
241 .Xr dump 8 ,
242 and
243 .Xr restore 8 .
244 In particular a tool which is not currently
245 .Nm
246 aware is the
247 .Xr pax 1
248 utility.