xref: /freebsd/bin/chflags/chflags.1 (revision 4d5ea49784fbdb9ba8218acbfc7f69e724d95387)
19ddb49cbSWarner Losh.\"-
29b50d902SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993, 1994
39b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
49b50d902SRodney W. Grimes.\"
59b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
69b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
79b50d902SRodney W. Grimes.\"
89b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
99b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
109b50d902SRodney W. Grimes.\" are met:
119b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
129b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
139b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
149b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
159b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
169b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
179b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
189b50d902SRodney W. Grimes.\"    without specific prior written permission.
199b50d902SRodney W. Grimes.\"
209b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
219b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
229b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
239b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
249b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
259b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
269b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
279b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
289b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
299b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
309b50d902SRodney W. Grimes.\" SUCH DAMAGE.
319b50d902SRodney W. Grimes.\"
3215856298SBruce Evans.\"	@(#)chflags.1	8.4 (Berkeley) 5/2/95
33c3aac50fSPeter Wemm.\" $FreeBSD$
349b50d902SRodney W. Grimes.\"
356de681c6STom Rhodes.Dd March 3, 2006
369b50d902SRodney W. Grimes.Dt CHFLAGS 1
379b50d902SRodney W. Grimes.Os
389b50d902SRodney W. Grimes.Sh NAME
399b50d902SRodney W. Grimes.Nm chflags
409b50d902SRodney W. Grimes.Nd change file flags
419b50d902SRodney W. Grimes.Sh SYNOPSIS
428fe908efSRuslan Ermilov.Nm
437e81a152SDima Dorfman.Op Fl h
449b50d902SRodney W. Grimes.Oo
459b50d902SRodney W. Grimes.Fl R
469b50d902SRodney W. Grimes.Op Fl H | Fl L | Fl P
479b50d902SRodney W. Grimes.Oc
489b50d902SRodney W. Grimes.Ar flags
49dd562b0eSPhilippe Charnier.Ar
509b50d902SRodney W. Grimes.Sh DESCRIPTION
519b50d902SRodney W. GrimesThe
52dd562b0eSPhilippe Charnier.Nm
539b50d902SRodney W. Grimesutility modifies the file flags of the listed files
549b50d902SRodney W. Grimesas specified by the
559b50d902SRodney W. Grimes.Ar flags
569b50d902SRodney W. Grimesoperand.
579b50d902SRodney W. Grimes.Pp
589b50d902SRodney W. GrimesThe options are as follows:
59dd562b0eSPhilippe Charnier.Bl -tag -width indent
609b50d902SRodney W. Grimes.It Fl H
619b50d902SRodney W. GrimesIf the
629b50d902SRodney W. Grimes.Fl R
639b50d902SRodney W. Grimesoption is specified, symbolic links on the command line are followed.
649b50d902SRodney W. Grimes(Symbolic links encountered in the tree traversal are not followed.)
657e81a152SDima Dorfman.It Fl h
667e81a152SDima DorfmanIf the
677e81a152SDima Dorfman.Ar file
687e81a152SDima Dorfmanis a symbolic link,
697e81a152SDima Dorfmanchange the mode of the link itself rather than the file to which it points.
709b50d902SRodney W. Grimes.It Fl L
719b50d902SRodney W. GrimesIf the
729b50d902SRodney W. Grimes.Fl R
739b50d902SRodney W. Grimesoption is specified, all symbolic links are followed.
749b50d902SRodney W. Grimes.It Fl P
759b50d902SRodney W. GrimesIf the
769b50d902SRodney W. Grimes.Fl R
779b50d902SRodney W. Grimesoption is specified, no symbolic links are followed.
7895a09b05SRuslan ErmilovThis is the default.
799b50d902SRodney W. Grimes.It Fl R
809b50d902SRodney W. GrimesChange the file flags for the file hierarchies rooted
819b50d902SRodney W. Grimesin the files instead of just the files themselves.
829b50d902SRodney W. Grimes.El
839b50d902SRodney W. Grimes.Pp
84ec9247d5SJohn PolstraThe flags are specified as an octal number or a comma separated list
85ec9247d5SJohn Polstraof keywords.
869b50d902SRodney W. GrimesThe following keywords are currently defined:
879b88faecSRuslan Ermilov.Pp
88fc6db5e3SGiorgos Keramidas.Bl -tag -offset indent -width ".Ar opaque"
89fc6db5e3SGiorgos Keramidas.It Ar arch , archived
909b88faecSRuslan Ermilovset the archived flag (super-user only)
919b88faecSRuslan Ermilov.It Ar opaque
929b88faecSRuslan Ermilovset the opaque flag (owner or super-user only)
939b88faecSRuslan Ermilov.It Ar nodump
949b88faecSRuslan Ermilovset the nodump flag (owner or super-user only)
95fc6db5e3SGiorgos Keramidas.It Ar sappnd , sappend
969b88faecSRuslan Ermilovset the system append-only flag (super-user only)
97fc6db5e3SGiorgos Keramidas.It Ar schg , schange , simmutable
989b88faecSRuslan Ermilovset the system immutable flag (super-user only)
99fc6db5e3SGiorgos Keramidas.It Ar sunlnk , sunlink
1009b88faecSRuslan Ermilovset the system undeletable flag (super-user only)
101fc6db5e3SGiorgos Keramidas.It Ar uappnd , uappend
1029b88faecSRuslan Ermilovset the user append-only flag (owner or super-user only)
103fc6db5e3SGiorgos Keramidas.It Ar uchg , uchange , uimmutable
1049b88faecSRuslan Ermilovset the user immutable flag (owner or super-user only)
105fc6db5e3SGiorgos Keramidas.It Ar uunlnk , uunlink
1069b88faecSRuslan Ermilovset the user undeletable flag (owner or super-user only)
1079b88faecSRuslan Ermilov.El
1089b50d902SRodney W. Grimes.Pp
1099b50d902SRodney W. GrimesPutting the letters
1109b88faecSRuslan Ermilov.Dq Ar no
111ab46875aSJohan Karlssonbefore or removing the letters
112ab46875aSJohan Karlsson.Dq Ar no
113ab46875aSJohan Karlssonfrom a keyword causes the flag to be cleared.
1149b50d902SRodney W. GrimesFor example:
115ab46875aSJohan Karlsson.Pp
116ab46875aSJohan Karlsson.Bl -tag -offset indent -width "nouchg" -compact
1179b88faecSRuslan Ermilov.It Ar nouchg
118ab46875aSJohan Karlssonclear the user immutable flag (owner or super-user only)
119ab46875aSJohan Karlsson.It Ar dump
120ab46875aSJohan Karlssonclear the nodump flag (owner or super-user only)
1219b88faecSRuslan Ermilov.El
1229b50d902SRodney W. Grimes.Pp
1236de681c6STom RhodesA few of the octal values include:
1244d5ea497STom Rhodes.Bl -tag -offset indent -width ".Li 10"
1256de681c6STom Rhodes.It Li 0
1266de681c6STom RhodesClear all file flags.
1276de681c6STom Rhodes.It Li 1
1286de681c6STom RhodesTranslates to the
1294d5ea497STom Rhodes.Cm nodump
1306de681c6STom Rhodeskeyword.
1316de681c6STom Rhodes.It Li 2
1326de681c6STom RhodesTranslates to the
1334d5ea497STom Rhodes.Cm uchg
1346de681c6STom Rhodeskeyword.
1356de681c6STom Rhodes.It Li 3
1366de681c6STom RhodesTranslates to the
1374d5ea497STom Rhodes.Cm uchg , nodump
1386de681c6STom Rhodeskeywords.
1396de681c6STom Rhodes.It Li 4
1406de681c6STom RhodesTranslates to the
1414d5ea497STom Rhodes.Cm uappnd
1426de681c6STom Rhodeskeyword.
1436de681c6STom Rhodes.It Li 10
1446de681c6STom RhodesTranslates to the
1454d5ea497STom Rhodes.Cm opaque
1466de681c6STom Rhodeskeyword.
1476de681c6STom Rhodes.It Li 20
1486de681c6STom Rhodestranslates to the
1494d5ea497STom Rhodes.Cm uunlnk
1506de681c6STom Rhodeskeyword.
1516de681c6STom Rhodes.El
1526de681c6STom Rhodes.Pp
1536de681c6STom RhodesOther combinations of keywords may be placed by using
1546de681c6STom Rhodesthe octets assigned; however, these are the most notable.
1556de681c6STom Rhodes.Pp
1567e81a152SDima DorfmanUnless the
1577e81a152SDima Dorfman.Fl H ,
1587e81a152SDima Dorfman.Fl L ,
1599b50d902SRodney W. Grimesor
1607e81a152SDima Dorfman.Fl h
1617e81a152SDima Dorfmanoptions are given,
162dd562b0eSPhilippe Charnier.Nm
1639b50d902SRodney W. Grimeson a symbolic link always succeeds and has no effect.
1649b50d902SRodney W. GrimesThe
1659b50d902SRodney W. Grimes.Fl H ,
1669b50d902SRodney W. Grimes.Fl L
1679b50d902SRodney W. Grimesand
1689b50d902SRodney W. Grimes.Fl P
1699b50d902SRodney W. Grimesoptions are ignored unless the
1709b50d902SRodney W. Grimes.Fl R
1719b50d902SRodney W. Grimesoption is specified.
1729b50d902SRodney W. GrimesIn addition, these options override each other and the
1739b50d902SRodney W. Grimescommand's actions are determined by the last one specified.
1749b50d902SRodney W. Grimes.Pp
175601fc2b9SPhilippe CharnierYou can use "ls -lo" to see the flags of existing files.
1766de681c6STom Rhodes.Pp
1776de681c6STom RhodesNote that the ability to change certain flags is dependent
1786de681c6STom Rhodeson the current kernel
1794d5ea497STom Rhodes.Va securelevel
1806de681c6STom Rhodessetting.
1816de681c6STom RhodesSee
1826de681c6STom Rhodes.Xr security 7
1836de681c6STom Rhodesfor more information on this setting.
1846fca4c7cSRuslan Ermilov.Sh EXIT STATUS
185d628d776SRuslan Ermilov.Ex -std
1869b50d902SRodney W. Grimes.Sh SEE ALSO
187601fc2b9SPhilippe Charnier.Xr ls 1 ,
1889b50d902SRodney W. Grimes.Xr chflags 2 ,
1899b50d902SRodney W. Grimes.Xr stat 2 ,
1909b50d902SRodney W. Grimes.Xr fts 3 ,
1916de681c6STom Rhodes.Xr security 7 ,
1929b50d902SRodney W. Grimes.Xr symlink 7
1937b020a2fSRuslan Ermilov.Sh HISTORY
1947b020a2fSRuslan ErmilovThe
1957b020a2fSRuslan Ermilov.Nm
1967b020a2fSRuslan Ermilovcommand first appeared in
1977b020a2fSRuslan Ermilov.Bx 4.4 .
19851cf6329STom Rhodes.Sh BUGS
19951cf6329STom RhodesOnly a limited number of utilities are
20051cf6329STom Rhodes.Nm
20151cf6329STom Rhodesaware.
20261001d75STom RhodesSome of these tools include
20351cf6329STom Rhodes.Xr ls 1 ,
20451cf6329STom Rhodes.Xr cp 1 ,
20551cf6329STom Rhodes.Xr find 1 ,
20661001d75STom Rhodes.Xr install 1 ,
20751cf6329STom Rhodes.Xr dump 8 ,
20851cf6329STom Rhodesand
20951cf6329STom Rhodes.Xr restore 8 .
21061001d75STom RhodesIn particular a tool which is not currently
21151cf6329STom Rhodes.Nm
21261001d75STom Rhodesaware is the
21361001d75STom Rhodes.Xr pax 1
21461001d75STom Rhodesutility.
215