1.\"- 2.\" Copyright (c) 2000-2001 Robert N. M. Watson 3.\" All rights reserved. 4.\" 5.\" This software was developed by Robert Watson for the TrustedBSD Project. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" Developed by the TrustedBSD Project. 29.\" Support for file system extended attribute. 30.\" 31.Dd March 30, 2000 32.Dt EXTATTRCTL 8 33.Os 34.Sh NAME 35.Nm extattrctl 36.Nd manage UFS1 extended attributes 37.Sh SYNOPSIS 38.Nm 39.Cm start 40.Ar path 41.Nm 42.Cm stop 43.Ar path 44.Nm 45.Cm initattr 46.Op Fl f 47.Op Fl p Ar path 48.Ar attrsize 49.Ar attrfile 50.Nm 51.Cm showattr 52.Ar attrfile 53.Nm 54.Cm enable 55.Ar path 56.Ar attrnamespace 57.Ar attrname 58.Ar attrfile 59.Nm 60.Cm disable 61.Ar path 62.Ar attrnamespace 63.Ar attrname 64.Sh DESCRIPTION 65The 66.Nm 67utility 68is the management utility for extended attributes over the UFS1 file system. 69It allows the starting and stopping of extended attributes on a file system, 70as well as initialization of attribute backing files, and enabling and 71disabling of specific extended attributes on a file system. 72.Pp 73The first argument on the command line indicates the operation to be 74performed. 75Operation must be one of the following: 76.Bl -tag -width indent 77.It Cm start Ar path 78Start extended attribute support on the file system named using 79.Ar path . 80The file system must be an UFS1 file system, and the UFS_EXTATTR kernel 81option must have been enabled. 82.It Cm stop Ar path 83Stop extended attribute support on the file system named using 84.Ar path . 85Extended attribute support must previously have been started. 86.It Xo 87.Cm initattr 88.Op Fl f 89.Op Fl p Ar path 90.Ar attrsize attrfile 91.Xc 92Create and initialize a file to use as an attribute backing file. 93You must specify a maximum per-inode size for the attribute in bytes in 94.Ar attrsize , 95as well as the file where the attribute will be stored, using 96.Ar attrfile . 97.Pp 98The 99.Fl f 100argument may be used to indicate that it is alright to overwrite an 101existing attribute backing file; otherwise, if the target file exists, 102an error will be returned. 103.Pp 104The 105.Fl p Ar path 106argument may be used to preallocate space for all attributes rather than 107relying on sparse files to conserve space. 108This has the advantage of guaranteeing that space will be available 109for attributes when they are written, preventing low disk space conditions 110from denying attribute service. 111.Pp 112This file should not exist before running 113.Cm initattr . 114.It Cm showattr Ar attrfile 115Show the attribute header values in the attribute file named by 116.Ar attrfile . 117.It Cm enable Ar path attrnamespace attrname attrfile 118Enable an attribute named 119.Ar attrname 120in the namespace 121.Ar attrnamespace 122on the file system identified using 123.Ar path , 124and backed by initialized attribute file 125.Ar attrfile . 126Available namespaces are "user" and "system". 127The backing file must have been initialized using 128.Cm initattr 129before its first use. 130Attributes must have been started on the file system prior to the 131enabling of any attributes. 132.It Cm disable Ar path attrnamespace attrname 133Disable the attributed named 134.Ar attrname 135in namespace 136.Ar attrnamespace 137on the file system identified by 138.Ar path . 139Available namespaces are "user" and "system". 140The file system must have attributes started on it, and the attribute 141most have been enabled using 142.Cm enable . 143.El 144.Sh EXAMPLES 145.Dl extattrctl start / 146.Pp 147Start extended attributes on the root file system. 148.Pp 149.Dl extattrctl initattr 17 /.attribute/system/md5 150.Pp 151Create an attribute backing file in /.attribute/system/md5, and set the maximum 152size of each attribute to 17 bytes, with a sparse file used for storing 153the attributes. 154.Pp 155.Dl extattrctl enable / system md5 /.attribute/system/md5 156.Pp 157Enable an attribute named md5 on the root file system, backed from the file 158/.attribute/system/md5. 159.Pp 160.Dl extattrctl disable / md5 161.Pp 162Disable the attribute named md5 on the root file system. 163.Pp 164.Dl extattrctl stop / 165.Pp 166Stop extended attributes on the root file system. 167.Sh SEE ALSO 168.Xr ffs 7 , 169.Xr getextattr 8 , 170.Xr setextattr 8 , 171.Xr extattr 9 172.Sh HISTORY 173Extended attribute support was developed as part of the TrustedBSD Project, 174and introduced in 175.Fx 5.0 . 176It was developed to support security extensions requiring additional labels 177to be associated with each file or directory. 178.Sh AUTHORS 179.An Robert N M Watson 180