NetBSD/usr.bin/extattr/getextattr.1

208 lines
5.2 KiB
Groff

.\" $NetBSD: getextattr.1,v 1.5 2011/07/14 22:14:03 wiz Exp $
.\"
.\"-
.\" Copyright (c) 2000, 2001 Robert N. M. Watson
.\" Copyright (c) 2002 Networks Associates Technology, Inc.
.\" All rights reserved.
.\"
.\" This software was developed for the FreeBSD Project by Poul-Henning
.\" Kamp and Network Associates Laboratories, the Security Research Division
.\" of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
.\" ("CBOSS"), as part of the DARPA CHATS research program
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/usr.sbin/extattr/rmextattr.8,v 1.4 2003/02/24 22:53:25 ru Exp $
.\"
.Dd January 2, 2005
.Dt GETEXTATTR 1
.Os
.Sh NAME
.Nm getextattr ,
.Nm lsextattr ,
.Nm rmextattr ,
.Nm setextattr
.Nd manipulate extended attributes
.Sh SYNOPSIS
.Nm getextattr
.Op Fl fhq
.Op Fl s | Fl x | Fl v Ar style
.Op Ar namespace
.Ar attrname
.Ar filename ...
.Nm lsextattr
.Op Fl fhq
.Ar namespace
.Ar filename ...
.Nm rmextattr
.Op Fl fhq
.Op Ar namespace
.Ar attrname
.Ar filename ...
.Nm setextattr
.Op Fl fhnq
.Op Ar namespace
.Ar attrname
.Ar attrvalue
.Ar filename ...
.Nm setextattr
.Op Fl fhnq
.Fl i Ar valuefile
.Op Ar namespace
.Ar attrname
.Ar filename ...
.Sh DESCRIPTION
These utilities are user tools to manipulate the named extended
attributes on files and directories.
.Pp
The
.Ar namespace
argument should be the namespace of the attribute to retrieve: legal
values are
.Cm user
and
.Cm system .
For all operations except
.Nm lsextattr ,
the namespace argument may be omitted if the attribute name is namespace
prefixed, like in
.Cm user.test .
In that later case, the
.Cm user
namespace prefix obviously selects
.Cm user
namespace.
.Cm system ,
.Cm security ,
and
.Cm trusted
namespace prefixes select the
.Cm system
namespace.
.Pp
The
.Ar attrname
argument should be the name of the attribute,
.Ar filename
the name of the target file or directory,
.Ar attrvalue
a string to store in the attribute.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl f
(Force.)
Ignore errors on individual filenames and continue with
the remaining arguments.
.It Fl h
(No follow.)
If the file is a symbolic link, perform the operation on the
link itself rather than the file that the link points to.
.It Fl i Ar valuefile
(Input file.)
Read the attribute value from file
.Ar valuefile .
Use this flag in order to set a binary value for an attribute.
.It Fl n
.Dv ( NUL Ns
-terminate.)
.Dv NUL Ns
-terminate the extent content written out.
.It Fl q
(Quiet.)
Do not print out the pathname and suppress error messages.
.It Fl s
(Stringify.)
Escape nonprinting characters and put quotes around the output.
.It Fl v Ar style
(Visual.)
Process the attribute value through
.Xr vis 3 ,
using
.Ar style .
Valid values for
.Ar style
are:
.Bl -tag -width indent
.It Ar default
Use default
.Xr vis 3
encoding.
.It Ar c
Use C-style backslash sequences, like in
.Nm vis Fl c .
.It Ar http
Use URI encoding from RFC 1808, like in
.Nm vis Fl h .
.It Ar octal
Display in octal, like in
.Nm vis Fl o .
.It Ar vis
Alias for
.Ar default .
.It Ar cstyle
Alias for
.Ar c .
.It Ar httpstyle
Alias for
.Ar http .
.El
.It Fl x
(Hex.)
Print the output in hexadecimal.
.El
.Sh EXAMPLES
.Bd -literal
setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel
getextattr system md5 /boot/kernel/kernel
lsextattr system /boot/kernel/kernel
rmextattr system md5 /boot/kernel/kernel
.Ed
.Pp
Examples omitting namespace (and attribute value) argument:
.Bd -literal
setextattr -i valuefile trusted.gfid /export/wd3a
getextattr -x trusted.gfid /export/wd3a
.Ed
.Sh SEE ALSO
.\" .Xr extattr 2 ,
.Xr extattr 3 ,
.Xr extattrctl 8 ,
.Xr extattr 9
.Sh HISTORY
Extended attribute support was developed as part of the
.Tn TrustedBSD
Project,
and introduced in
.Fx 5.0
and
.Nx 3.0 .
It was developed to support security extensions requiring additional labels
to be associated with each file or directory.
.Pp
Extended attribute support was resurrected and made more usable in
.Nx 5.2 .
.Sh AUTHORS
.An Robert N M Watson
.An Poul-Henning Kamp
.An Emmanuel Dreyfus