xref: /freebsd/usr.sbin/extattr/rmextattr.8 (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1.\"-
2.\" Copyright (c) 2000, 2001 Robert N. M. Watson
3.\" Copyright (c) 2002 Networks Associates Technology, Inc.
4.\" All rights reserved.
5.\"
6.\" This software was developed for the FreeBSD Project by Poul-Henning
7.\" Kamp and Network Associates Laboratories, the Security Research Division
8.\" of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
9.\" ("CBOSS"), as part of the DARPA CHATS research program
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" $FreeBSD$
33.\"
34.Dd April 27, 2016
35.Dt RMEXTATTR 8
36.Os
37.Sh NAME
38.Nm getextattr ,
39.Nm lsextattr ,
40.Nm rmextattr ,
41.Nm setextattr
42.Nd manipulate extended attributes
43.Sh SYNOPSIS
44.Nm getextattr
45.Op Fl fhqsx
46.Ar attrnamespace
47.Ar attrname
48.Ar filename ...
49.Nm lsextattr
50.Op Fl fhq
51.Ar attrnamespace
52.Ar filename ...
53.Nm rmextattr
54.Op Fl fhq
55.Ar attrnamespace
56.Ar attrname
57.Ar filename ...
58.Nm setextattr
59.Op Fl fhnq
60.Ar attrnamespace
61.Ar attrname
62.Ar attrvalue
63.Ar filename ...
64.Nm setextattr
65.Fl i
66.Op Fl fhnq
67.Ar attrnamespace
68.Ar attrname
69.Ar filename ...
70.Sh DESCRIPTION
71These
72utilities
73are user tools to manipulate the named extended attributes on files and
74directories.
75The
76.Ar attrnamespace
77argument should be the namespace of the attribute to retrieve: legal
78values are
79.Cm user
80and
81.Cm system .
82The
83.Ar attrname
84argument should be the name of the attribute,
85.Ar filename
86the name of the target file or directory,
87.Ar attrvalue
88a string to store in the attribute.
89.Pp
90The following options are available:
91.Bl -tag -width indent
92.It Fl f
93(Force.)
94Ignore errors on individual filenames and continue with
95the remaining arguments.
96.It Fl h
97(No follow.)
98If the file is a symbolic link, perform the operation on the
99link itself rather than the file that the link points to.
100.It Fl i
101(From stdin.)
102Read attribute data from stdin instead of as an argument.
103.It Fl n
104.Dv ( NUL Ns
105-terminate.)
106.Dv NUL Ns
107-terminate the extent content written out.
108.It Fl q
109(Quiet.)
110Do not print out the pathname and suppress error messages.
111When given twice, print only the attribute value, with no trailing newline.
112.It Fl s
113(Stringify.)
114Escape nonprinting characters and put quotes around the output.
115.It Fl x
116(Hex.)
117Print the output in hexadecimal.
118.El
119.Sh EXAMPLES
120.Bd -literal
121setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel
122md5 -q /boot/kernel/kernel | setextattr -i system md5 /boot/kernel/kernel
123getextattr system md5 /boot/kernel/kernel
124getextattr -qq system md5 /boot/kernel/kernel | od -x
125lsextattr system /boot/kernel/kernel
126rmextattr system md5 /boot/kernel/kernel
127.Ed
128.Sh SEE ALSO
129.Xr extattr 2 ,
130.Xr extattr 3 ,
131.Xr extattrctl 8 ,
132.Xr extattr 9
133.Sh HISTORY
134Extended attribute support was developed as part of the
135.Tn TrustedBSD
136Project,
137and introduced in
138.Fx 5.0 .
139It was developed to support security extensions requiring additional labels
140to be associated with each file or directory.
141.Sh AUTHORS
142.An Robert N M Watson
143.An Poul-Henning Kamp
144