1*52efc5a5Suwe.\" $NetBSD: chflags.1,v 1.32 2023/05/31 20:33:22 uwe Exp $ 26e0c4dedSjtc.\" 39636069cSjtc.\" Copyright (c) 1989, 1990, 1993, 1994 49636069cSjtc.\" The Regents of the University of California. All rights reserved. 59636069cSjtc.\" 69636069cSjtc.\" This code is derived from software contributed to Berkeley by 79636069cSjtc.\" the Institute of Electrical and Electronics Engineers, Inc. 89636069cSjtc.\" 99636069cSjtc.\" Redistribution and use in source and binary forms, with or without 109636069cSjtc.\" modification, are permitted provided that the following conditions 119636069cSjtc.\" are met: 129636069cSjtc.\" 1. Redistributions of source code must retain the above copyright 139636069cSjtc.\" notice, this list of conditions and the following disclaimer. 149636069cSjtc.\" 2. Redistributions in binary form must reproduce the above copyright 159636069cSjtc.\" notice, this list of conditions and the following disclaimer in the 169636069cSjtc.\" documentation and/or other materials provided with the distribution. 1789aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors 189636069cSjtc.\" may be used to endorse or promote products derived from this software 199636069cSjtc.\" without specific prior written permission. 209636069cSjtc.\" 219636069cSjtc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 229636069cSjtc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 239636069cSjtc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 249636069cSjtc.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 259636069cSjtc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 269636069cSjtc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 279636069cSjtc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 289636069cSjtc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 299636069cSjtc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 309636069cSjtc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 319636069cSjtc.\" SUCH DAMAGE. 329636069cSjtc.\" 339cffeee5Sjtc.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95 349636069cSjtc.\" 35cdcf39f5Sjschauma.Dd May 25, 2023 369636069cSjtc.Dt CHFLAGS 1 379636069cSjtc.Os 389636069cSjtc.Sh NAME 399636069cSjtc.Nm chflags 409636069cSjtc.Nd change file flags 419636069cSjtc.Sh SYNOPSIS 425f18af1fSlukem.Nm 439636069cSjtc.Oo 449636069cSjtc.Fl R 459636069cSjtc.Op Fl H | Fl L | Fl P 469636069cSjtc.Oc 47da39777eSkre.Op Fl d 4896d6ef20Senami.Op Fl h 499636069cSjtc.Ar flags 5096d6ef20Senami.Ar 519636069cSjtc.Sh DESCRIPTION 529636069cSjtcThe 535f18af1fSlukem.Nm 549636069cSjtcutility modifies the file flags of the listed files 559636069cSjtcas specified by the 569636069cSjtc.Ar flags 579636069cSjtcoperand. 589636069cSjtc.Pp 599636069cSjtcThe options are as follows: 6013772c73Suwe.Bl -tag -width Fl 61da39777eSkre.It Fl d 62da39777eSkreIf the change requested would not alter the 63da39777eSkreflags currently set for 64da39777eSkre.Ar file 65da39777eSkrethen attempt no change operation. 669636069cSjtc.It Fl H 679636069cSjtcIf the 689636069cSjtc.Fl R 699636069cSjtcoption is specified, symbolic links on the command line are followed. 7013772c73SuweSymbolic links encountered in the tree traversal are not followed. 718fd1bb62Swiz.It Fl h 728fd1bb62SwizIf the 738fd1bb62Swiz.Ar file 748fd1bb62Swizor a file encountered during directory traversal is a symbolic link, 7513772c73Suwethe file flags of the link itself are changed. 769636069cSjtc.It Fl L 779636069cSjtcIf the 789636069cSjtc.Fl R 799636069cSjtcoption is specified, all symbolic links are followed. 809636069cSjtc.It Fl P 819636069cSjtcIf the 829636069cSjtc.Fl R 839636069cSjtcoption is specified, no symbolic links are followed. 849636069cSjtc.It Fl R 859636069cSjtcChange the file flags for the file hierarchies rooted 8663eb8c37Sdhollandin the 8713772c73Suwe.Ar file\^ Ns s 8863eb8c37Sdhollandinstead of just the 8913772c73Suwe.Ar file\^ Ns s 9063eb8c37Sdhollandthemselves. 919636069cSjtc.El 929636069cSjtc.Pp 939636069cSjtcFlags are a comma separated list of keywords. 949636069cSjtcThe following keywords are currently defined: 9513772c73Suwe.\" XXX: list the actual chflags(2) macro names 9613772c73Suwe.Bl -column -offset indent ".Sy Keyword" "system append-only" 97280a4e34Sjruoho.It Sy Keyword Ta Sy Flag Ta Sy Permission 9813772c73Suwe.It Li arch Ta archived Ta super-user only 9913772c73Suwe.It Li opaque Ta opaque Ta owner or super-user 10013772c73Suwe.It Li nodump Ta nodump Ta owner or super-user 10113772c73Suwe.It Li sappnd Ta system append-only Ta super-user only 10213772c73Suwe.It Li schg Ta system immutable Ta super-user only 10313772c73Suwe.It Li uappnd Ta user append-only Ta owner or super-user 10413772c73Suwe.It Li uchg Ta user immutable Ta owner or super-user 1059fc37247Sjruoho.El 1069636069cSjtc.Pp 1079636069cSjtcPutting the letters 10813772c73Suwe.Sq Cm no 10913772c73Suwebefore a keyword causes the flag to be turned off. 11013772c73SuweFor example, 11113772c73Suwe.Li nouchg 11213772c73Suwerequests the immutable bit should be cleared. 1139636069cSjtc.Pp 1149636069cSjtcThe 1159636069cSjtc.Fl H , 1169636069cSjtc.Fl L 1179636069cSjtcand 1189636069cSjtc.Fl P 1199636069cSjtcoptions are ignored unless the 1209636069cSjtc.Fl R 1219636069cSjtcoption is specified. 1229636069cSjtcIn addition, these options override each other and the 1239636069cSjtccommand's actions are determined by the last one specified. 12481b1fb1dSapbThe default is as if the 12581b1fb1dSapb.Fl P 12681b1fb1dSapboption had been specified. 1279636069cSjtc.Pp 1289636069cSjtcThe 129f0dcae64Slukem.Fl o 130f0dcae64Slukemoption 131f0dcae64Slukemof 132f0dcae64Slukem.Xr ls 1 133f0dcae64Slukemis used to display the flags. 134f0dcae64Slukem.Pp 135022cc95fSchristosThe kernel does not allow the flags on block and character 136d4f8f51fSaddevices to be changed except by the super-user. 1377abe1e38Sjschauma.Pp 1387abe1e38SjschaumaNote that the ability to clear certain flags is 1397abe1e38Sjschaumadependent on the current kernel 14013772c73Suwe.Va securelevel . 1417abe1e38SjschaumaSee 1427abe1e38Sjschauma.Xr secmodel_securelevel 9 1437abe1e38Sjschaumafor details. 1448fd1bb62Swiz.Sh EXIT STATUS 1458fd1bb62Swiz.Ex -std 1469636069cSjtc.Sh SEE ALSO 147f0dcae64Slukem.Xr ls 1 , 1489636069cSjtc.Xr chflags 2 , 14996d6ef20Senami.Xr lchflags 2 , 1509636069cSjtc.Xr stat 2 , 1519636069cSjtc.Xr fts 3 , 152*52efc5a5Suwe.Xr stat_flags 3 , 153e08bd0ceSbouyer.Xr symlink 7 , 15432e3bfbdSchopps.Xr dump 8 , 1550102e2deSjschauma.Xr init 8 , 1560102e2deSjschauma.Xr secmodel_securelevel 9 157