summaryrefslogtreecommitdiff
path: root/man/man1/setfattr.1
blob: e011ca705de70bcc28fd2f98e576802b1597997d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.\" Copyright (C) 2002, 2004  Silicon Graphics, Inc. Al rights reserved.
.\" Copyright (C) 2002, 2004  Andreas Gruenbacher <agruen@suse.de>
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual.  If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH SETFATTR 1 "Extended Attributes" "Dec 2001" "File Utilities"
.SH NAME
setfattr \- set extended attributes of filesystem objects
.SH SYNOPSIS
.nf
\f3setfattr\f1 [\f3\-h\f1] \f3\-n name\f1 [\f3\-v value\f1] \f3pathname\f1...
\f3setfattr\f1 [\f3\-h\f1] \f3\-x name\f1 \f3pathname\f1...
\f3setfattr\f1 [\f3\-h\f1] \f3\-\-restore=file\f1
.fi
.SH DESCRIPTION
The 
.B setfattr
command associates a new
.I value
with an extended attribute
.IR name
for each specified file.
.SH OPTIONS
.TP 4
.BR \-n " \f2name\f1, " \-\-name "=\f2name\f1"
Specifies the name of the extended attribute to set.
.TP
.BR \-v " \f2value\f1, " \-\-value "=\f2value\f1"
Specifies the new value of the extended attribute. There are three methods
available for encoding the value.  If the given string is enclosed in double
quotes, the inner string is treated as text. In that case, backslashes and
double quotes have special meanings and need to be escaped by a preceding
backslash. Any control characters can be encoded as a backslash followed by
three digits as its ASCII code in octal. If the given string begins with 0x or
0X, it expresses a hexadecimal number. If the given string begins with 0s or
0S, base64 encoding is expected.  Also see the \-\-encoding option of
getfattr(1).
.TP
.BR \-x " \f2name\f1, " \-\-remove "=\f2name\f1"
Remove the named extended attribute entirely.
.TP
.BR \-h ", " \-\-no-dereference
Do not follow symlinks.  If
.I pathname
is a symbolic link, it is not followed, but is instead itself the
inode being modified.
.TP
.BR \-\-restore =\f2file\f1
Restores extended attributes from file.
The file must be in the format generated by the
.B getfattr
command with the
.B \-\-dump
option.
If a dash (\c
.IR \- )
is given as the file name,
.B setfattr
reads from standard input.
.TP
.B \-\-raw
Do not decode the attribute value. Can be used to set values obtained with
.BR "getfattr --only-values" .
.TP
.B \-\-version
Print the version of
.B setfattr
and exit.
.TP
.B \-\-help
Print help explaining the command line options.
.TP
.B \-\-
End of command line options.
All remaining parameters are interpreted as file names, even if they
start with a dash character.
.SH EXAMPLES
Add extended attribute to user namespace:
.PP
.nf
.B "$ setfattr -n user.foo -v bar file.txt
.fi
.PP
To add md5sum of the file as an extended attribute:
.PP
.nf
.B "# setfattr -n trusted.md5sum -v d41d8cd98f00b204e00998ecf8427e file.txt
.fi
.SH AUTHOR
Andreas Gruenbacher,
.RI < andreas.gruenbacher@gmail.com >
and the SGI XFS development team,
.RI < linux-xfs@oss.sgi.com >.
.P
Please send your bug reports or comments to
.RI < https://savannah.nongnu.org/bugs/?group=attr >
or
.RI < acl-devel@nongnu.org >.
.SH "SEE ALSO"
.BR getfattr (1),
.BR xattr (7)