1SETFATTR(1) File Utilities SETFATTR(1)
2
3
4
6 setfattr - set extended attributes of filesystem objects
7
9 setfattr [-h] -n name [-v value] pathname...
10 setfattr [-h] -x name pathname...
11 setfattr [-h] --restore=file
12
14 The setfattr command associates a new value with an extended attribute
15 name for each specified file.
16
18 -n name, --name=name
19 Specifies the name of the extended attribute to set.
20
21 -v value, --value=value
22 Specifies the new value of the extended attribute. There are three
23 methods available for encoding the value. If the given string is
24 enclosed in double quotes, the inner string is treated as text. In
25 that case, backslashes and double quotes have special meanings and
26 need to be escaped by a preceding backslash. Any control characters
27 can be encoded as a backslash followed by three digits as its ASCII
28 code in octal. If the given string begins with 0x or 0X, it ex‐
29 presses a hexadecimal number. If the given string begins with 0s or
30 0S, base64 encoding is expected. Also see the --encoding option of
31 getfattr(1).
32
33 -x name, --remove=name
34 Remove the named extended attribute entirely.
35
36 -h, --no-dereference
37 Do not follow symlinks. If pathname is a symbolic link, it is not
38 followed, but is instead itself the inode being modified.
39
40 --restore=file
41 Restores extended attributes from file. The file must be in the
42 format generated by the getfattr command with the --dump option.
43 If a dash (-) is given as the file name, setfattr reads from stan‐
44 dard input.
45
46 --raw
47 Do not decode the attribute value. Can be used to set values ob‐
48 tained with getfattr --only-values.
49
50 --version
51 Print the version of setfattr and exit.
52
53 --help
54 Print help explaining the command line options.
55
56 -- End of command line options. All remaining parameters are inter‐
57 preted as file names, even if they start with a dash character.
58
60 Add extended attribute to user namespace:
61
62 $ setfattr -n user.foo -v bar file.txt
63
64 To add md5sum of the file as an extended attribute:
65
66 # setfattr -n trusted.md5sum -v d41d8cd98f00b204e00998ecf8427e file.txt
67
69 Andreas Gruenbacher, <andreas.gruenbacher@gmail.com> and the SGI XFS
70 development team, <linux-xfs@oss.sgi.com>.
71
72 Please send your bug reports or comments to <https://savan‐
73 nah.nongnu.org/bugs/?group=attr> or <acl-devel@nongnu.org>.
74
76 getfattr(1), attr(5)
77
78
79
80Dec 2001 Extended Attributes SETFATTR(1)