xref: /netbsd-src/usr.sbin/extattrctl/extattrctl.8 (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1.\"	$NetBSD: extattrctl.8,v 1.2 2005/09/23 20:58:50 wiz 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 Xo
91.Cm initattr
92.Op Fl f
93.Op Fl p Ar path
94.Ar attrsize attrfile
95.Xc
96Create and initialize a file to use as an attribute backing file.
97You must specify a maximum per-inode size for the attribute in bytes in
98.Ar attrsize ,
99as well as the file where the attribute will be stored, using
100.Ar attrfile .
101.Pp
102The
103.Fl f
104argument may be used to indicate that it is alright to overwrite an
105existing attribute backing file; otherwise, if the target file exists,
106an error will be returned.
107.Pp
108The
109.Fl p Ar path
110argument may be used to preallocate space for all attributes rather than
111relying on sparse files to conserve space.
112This has the advantage of guaranteeing that space will be available
113for attributes when they are written, preventing low disk space conditions
114from denying attribute service.
115.Pp
116This file should not exist before running
117.Cm initattr .
118.It Cm showattr Ar attrfile
119Show the attribute header values in the attribute file named by
120.Ar attrfile .
121.It Cm enable Ar path attrnamespace attrname attrfile
122Enable an attribute named
123.Ar attrname
124in the namespace
125.Ar attrnamespace
126on the file system identified using
127.Ar path ,
128and backed by initialized attribute file
129.Ar attrfile .
130Available namespaces are
131.Dq user
132and
133.Dq system .
134The backing file must have been initialized using
135.Cm initattr
136before its first use.
137Attributes must have been started on the file system prior to the
138enabling of any attributes.
139.It Cm disable Ar path attrnamespace attrname
140Disable the attributed named
141.Ar attrname
142in namespace
143.Ar attrnamespace
144on the file system identified by
145.Ar path .
146Available namespaces are
147.Dq user
148and
149.Dq system .
150The file system must have attributes started on it, and the attribute
151most have been enabled using
152.Cm enable .
153.El
154.Pp
155The kernel also includes support for automatic starting of extended
156attributes on a file system at mount time once configured with
157.Nm .
158If the kernel is built with the
159.Dv UFS_EXTATTR_AUTOSTART
160option, UFS will search for a
161.Pa .attribute
162sub-directory of the file system root during the mount operation.
163If found, extended attribute support will be started for the file system.
164UFS will then search for
165.Pa system
166and
167.Pa user
168sub-directories of the
169.Pa .attribute
170directory for any potential backing files and enable an extended attribute
171for each valid backing file with the backing file name as the attribute
172name.
173.Sh EXAMPLES
174.Dl extattrctl start /
175.Pp
176Start extended attributes on the root file system.
177.Pp
178.Dl extattrctl initattr 17 /.attribute/system/md5
179.Pp
180Create an attribute backing file in
181.Pa /.attribute/system/md5 ,
182and set the maximum size of each attribute to 17 bytes, with a
183sparse file used for storing the attributes.
184.Pp
185.Dl extattrctl enable / system md5 /.attribute/system/md5
186.Pp
187Enable an attribute named md5 on the root file system, backed from the file
188.Pa /.attribute/system/md5 .
189.Pp
190.Dl extattrctl disable / md5
191.Pp
192Disable the attribute named md5 on the root file system.
193.Pp
194.Dl extattrctl stop /
195.Pp
196Stop extended attributes on the root file system.
197.Sh SEE ALSO
198.Xr extattr_get_file 2 ,
199.\" .Xr ffs 7 ,
200.Xr getextattr 8 ,
201.Xr extattr 9
202.Sh HISTORY
203Extended attribute support was developed as part of the TrustedBSD
204Project, and introduced in
205.Fx 5.0
206and
207.Nx 4.0 .
208It was developed to support security extensions requiring additional
209labels to be associated with each file or directory.
210.Sh AUTHORS
211.An Robert N M Watson
212.Sh BUGS
213.Nm
214works only on UFS1 file systems.
215The kernel support for extended attribute backing files and this
216control program should be generalized for any file system that
217lacks native extended attribute support.
218