xref: /freebsd/bin/chflags/chflags.1 (revision 7bd6fde3)
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 h
44.Oo
45.Fl R
46.Op Fl H | Fl L | Fl P
47.Oc
48.Ar flags
49.Ar
50.Sh DESCRIPTION
51The
52.Nm
53utility modifies the file flags of the listed files
54as specified by the
55.Ar flags
56operand.
57.Pp
58The options are as follows:
59.Bl -tag -width indent
60.It Fl H
61If the
62.Fl R
63option is specified, symbolic links on the command line are followed.
64(Symbolic links encountered in the tree traversal are not followed.)
65.It Fl h
66If the
67.Ar file
68is a symbolic link,
69change the mode of the link itself rather than the file to which it points.
70.It Fl L
71If the
72.Fl R
73option is specified, all symbolic links are followed.
74.It Fl P
75If the
76.Fl R
77option is specified, no symbolic links are followed.
78This is the default.
79.It Fl R
80Change the file flags for the file hierarchies rooted
81in the files instead of just the files themselves.
82.El
83.Pp
84The flags are specified as an octal number or a comma separated list
85of keywords.
86The following keywords are currently defined:
87.Pp
88.Bl -tag -offset indent -width ".Cm opaque"
89.It Cm arch , archived
90set the archived flag (super-user only)
91.It Cm opaque
92set the opaque flag (owner or super-user only)
93.It Cm nodump
94set the nodump flag (owner or super-user only)
95.It Cm sappnd , sappend
96set the system append-only flag (super-user only)
97.It Cm schg , schange , simmutable
98set the system immutable flag (super-user only)
99.It Cm sunlnk , sunlink
100set the system undeletable flag (super-user only)
101.It Cm uappnd , uappend
102set the user append-only flag (owner or super-user only)
103.It Cm uchg , uchange , uimmutable
104set the user immutable flag (owner or super-user only)
105.It Cm uunlnk , uunlink
106set the user undeletable flag (owner or super-user only)
107.El
108.Pp
109Putting the letters
110.Dq Ar no
111before or removing the letters
112.Dq Ar no
113from a keyword causes the flag to be cleared.
114For example:
115.Pp
116.Bl -tag -offset indent -width "nouchg" -compact
117.It Cm nouchg
118clear the user immutable flag (owner or super-user only)
119.It Cm dump
120clear the nodump flag (owner or super-user only)
121.El
122.Pp
123A few of the octal values include:
124.Bl -tag -offset indent -width ".Li 10"
125.It Li 0
126Clear all file flags.
127.It Li 1
128Translates to the
129.Cm nodump
130keyword.
131.It Li 2
132Translates to the
133.Cm uchg
134keyword.
135.It Li 3
136Translates to the
137.Cm uchg , nodump
138keywords.
139.It Li 4
140Translates to the
141.Cm uappnd
142keyword.
143.It Li 10
144Translates to the
145.Cm opaque
146keyword.
147.It Li 20
148translates to the
149.Cm uunlnk
150keyword.
151.El
152.Pp
153Other combinations of keywords may be placed by using
154the octets assigned; however, these are the most notable.
155.Pp
156Unless the
157.Fl H ,
158.Fl L ,
159or
160.Fl h
161options are given,
162.Nm
163on a symbolic link always succeeds and has no effect.
164The
165.Fl H ,
166.Fl L
167and
168.Fl P
169options are ignored unless the
170.Fl R
171option is specified.
172In addition, these options override each other and the
173command's actions are determined by the last one specified.
174.Pp
175You can use "ls -lo" to see the flags of existing files.
176.Pp
177Note that the ability to change certain flags is dependent
178on the current kernel
179.Va securelevel
180setting.
181See
182.Xr security 7
183for more information on this setting.
184.Sh EXIT STATUS
185.Ex -std
186.Sh SEE ALSO
187.Xr ls 1 ,
188.Xr chflags 2 ,
189.Xr stat 2 ,
190.Xr fts 3 ,
191.Xr security 7 ,
192.Xr symlink 7
193.Sh HISTORY
194The
195.Nm
196command first appeared in
197.Bx 4.4 .
198.Sh BUGS
199Only a limited number of utilities are
200.Nm
201aware.
202Some of these tools include
203.Xr ls 1 ,
204.Xr cp 1 ,
205.Xr find 1 ,
206.Xr install 1 ,
207.Xr dump 8 ,
208and
209.Xr restore 8 .
210In particular a tool which is not currently
211.Nm
212aware is the
213.Xr pax 1
214utility.
215