xref: /netbsd/usr.sbin/extattrctl/extattrctl.8 (revision 6550d01e)
1.\"	$NetBSD: extattrctl.8,v 1.3 2009/03/11 18:05:37 joerg Exp $
2.\"
3.\" Copyright (c) 2000-2001 Robert N. M. Watson
4.\" All rights reserved.
5.\"
6.\" This software was developed by Robert Watson for the TrustedBSD Project.
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.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\" $FreeBSD: src/usr.sbin/extattrctl/extattrctl.8,v 1.24 2005/02/09 18:04:40 ru Exp $
30.\"
31.\" Developed by the TrustedBSD Project.
32.\" Support for file system extended attribute.
33.\"
34.Dd July 11, 2005
35.Dt EXTATTRCTL 8
36.Os
37.Sh NAME
38.Nm extattrctl
39.Nd manage UFS1 extended attributes
40.Sh SYNOPSIS
41.Nm
42.Cm start
43.Ar path
44.Nm
45.Cm stop
46.Ar path
47.Nm
48.Cm initattr
49.Op Fl f
50.Op Fl p Ar path
51.Ar attrsize
52.Ar attrfile
53.Nm
54.Cm showattr
55.Ar attrfile
56.Nm
57.Cm enable
58.Ar path
59.Ar attrnamespace
60.Ar attrname
61.Ar attrfile
62.Nm
63.Cm disable
64.Ar path
65.Ar attrnamespace
66.Ar attrname
67.Sh DESCRIPTION
68The
69.Nm
70utility
71is the management utility for extended attributes over the UFS1 file system.
72It allows the starting and stopping of extended attributes on a file system,
73as well as initialization of attribute backing files, and enabling and
74disabling of specific extended attributes on a file system.
75.Pp
76The first argument on the command line indicates the operation to be
77performed.
78Operation must be one of the following:
79.Bl -tag -width indent
80.It Cm start Ar path
81Start extended attribute support on the file system named using
82.Ar path .
83The file system must be a UFS1 file system, and the
84.Dv UFS_EXTATTR
85kernel option must have been enabled.
86.It Cm stop Ar path
87Stop extended attribute support on the file system named using
88.Ar path .
89Extended attribute support must previously have been started.
90.It Cm initattr Oo Fl f Oc Oo Fl p Ar path Oc Ar attrsize attrfile
91Create and initialize a file to use as an attribute backing file.
92You must specify a maximum per-inode size for the attribute in bytes in
93.Ar attrsize ,
94as well as the file where the attribute will be stored, using
95.Ar attrfile .
96.Pp
97The
98.Fl f
99argument may be used to indicate that it is alright to overwrite an
100existing attribute backing file; otherwise, if the target file exists,
101an error will be returned.
102.Pp
103The
104.Fl p Ar path
105argument may be used to preallocate space for all attributes rather than
106relying on sparse files to conserve space.
107This has the advantage of guaranteeing that space will be available
108for attributes when they are written, preventing low disk space conditions
109from denying attribute service.
110.Pp
111This file should not exist before running
112.Cm initattr .
113.It Cm showattr Ar attrfile
114Show the attribute header values in the attribute file named by
115.Ar attrfile .
116.It Cm enable Ar path attrnamespace attrname attrfile
117Enable an attribute named
118.Ar attrname
119in the namespace
120.Ar attrnamespace
121on the file system identified using
122.Ar path ,
123and backed by initialized attribute file
124.Ar attrfile .
125Available namespaces are
126.Dq user
127and
128.Dq system .
129The backing file must have been initialized using
130.Cm initattr
131before its first use.
132Attributes must have been started on the file system prior to the
133enabling of any attributes.
134.It Cm disable Ar path attrnamespace attrname
135Disable the attributed named
136.Ar attrname
137in namespace
138.Ar attrnamespace
139on the file system identified by
140.Ar path .
141Available namespaces are
142.Dq user
143and
144.Dq system .
145The file system must have attributes started on it, and the attribute
146most have been enabled using
147.Cm enable .
148.El
149.Pp
150The kernel also includes support for automatic starting of extended
151attributes on a file system at mount time once configured with
152.Nm .
153If the kernel is built with the
154.Dv UFS_EXTATTR_AUTOSTART
155option, UFS will search for a
156.Pa .attribute
157sub-directory of the file system root during the mount operation.
158If found, extended attribute support will be started for the file system.
159UFS will then search for
160.Pa system
161and
162.Pa user
163sub-directories of the
164.Pa .attribute
165directory for any potential backing files and enable an extended attribute
166for each valid backing file with the backing file name as the attribute
167name.
168.Sh EXAMPLES
169.Dl extattrctl start /
170.Pp
171Start extended attributes on the root file system.
172.Pp
173.Dl extattrctl initattr 17 /.attribute/system/md5
174.Pp
175Create an attribute backing file in
176.Pa /.attribute/system/md5 ,
177and set the maximum size of each attribute to 17 bytes, with a
178sparse file used for storing the attributes.
179.Pp
180.Dl extattrctl enable / system md5 /.attribute/system/md5
181.Pp
182Enable an attribute named md5 on the root file system, backed from the file
183.Pa /.attribute/system/md5 .
184.Pp
185.Dl extattrctl disable / md5
186.Pp
187Disable the attribute named md5 on the root file system.
188.Pp
189.Dl extattrctl stop /
190.Pp
191Stop extended attributes on the root file system.
192.Sh SEE ALSO
193.Xr extattr_get_file 2 ,
194.\" .Xr ffs 7 ,
195.Xr getextattr 8 ,
196.Xr extattr 9
197.Sh HISTORY
198Extended attribute support was developed as part of the TrustedBSD
199Project, and introduced in
200.Fx 5.0
201and
202.Nx 4.0 .
203It was developed to support security extensions requiring additional
204labels to be associated with each file or directory.
205.Sh AUTHORS
206.An Robert N M Watson
207.Sh BUGS
208.Nm
209works only on UFS1 file systems.
210The kernel support for extended attribute backing files and this
211control program should be generalized for any file system that
212lacks native extended attribute support.
213