1 .\" Extended attributes manual page
3 .\" Copyright (C) 2000, 2002, 2007 Andreas Gruenbacher <agruen@suse.de>
4 .\" Copyright (C) 2001, 2002, 2004, 2007 Silicon Graphics, Inc.
5 .\" All rights reserved.
7 .\" SPDX-License-Identifier: GPL-2.0-or-later
9 .TH xattr 7 (date) "Linux man-pages (unreleased)"
11 xattr \- Extended attributes
13 Extended attributes are name:value pairs associated permanently with
14 files and directories, similar to the environment strings associated
16 An attribute may be defined or undefined.
17 If it is defined, its value may be empty or non-empty.
19 Extended attributes are extensions to the normal attributes which are
20 associated with all inodes in the system (i.e., the
23 They are often used to provide additional functionality
24 to a filesystem\[em]for example, additional security features such as
25 Access Control Lists (ACLs) may be implemented using extended attributes.
27 Users with search access to a file or directory may use
29 to retrieve a list of attribute names defined for that file or directory.
31 Extended attributes are accessed as atomic objects.
34 retrieves the whole value of an attribute and stores it in a buffer.
37 replaces any previous value with the new value.
39 Space consumed for extended attributes may be counted towards the disk quotas
40 of the file owner and file group.
41 .SS Extended attribute namespaces
42 Attribute names are null-terminated strings.
43 The attribute name is always specified in the fully qualified
44 .I namespace.attribute
48 .IR system.posix_acl_access ,
50 .IR security.selinux .
52 The namespace mechanism is used to define different classes of extended
54 These different classes exist for several reasons;
55 for example, the permissions
56 and capabilities required for manipulating extended attributes of one
57 namespace may differ to another.
65 extended attribute classes are defined as described below.
66 Additional classes may be added in the future.
67 .SS Extended security attributes
68 The security attribute namespace is used by kernel security modules,
69 such as Security Enhanced Linux, and also to implement file capabilities (see
70 .BR capabilities (7)).
71 Read and write access permissions to security attributes depend on the
72 policy implemented for each security attribute by the security module.
73 When no security module is loaded, all processes have read access to
74 extended security attributes, and write access is limited to processes
78 .SS System extended attributes
79 System extended attributes are used by the kernel to store system
80 objects such as Access Control Lists.
82 access permissions to system attributes depend on the policy implemented
83 for each system attribute implemented by filesystems in the kernel.
84 .SS Trusted extended attributes
85 Trusted extended attributes are visible and accessible only to processes that
89 Attributes in this class are used to implement mechanisms in user
90 space (i.e., outside the kernel) which keep information in extended attributes
91 to which ordinary processes should not have access.
92 .SS User extended attributes
93 User extended attributes may be assigned to files and directories for
94 storing arbitrary additional information such as the mime type,
95 character set or encoding of a file.
96 The access permissions for user
97 attributes are defined by the file permission bits:
98 read permission is required to retrieve the attribute value,
99 and writer permission is required to change it.
101 The file permission bits of regular files and directories are
102 interpreted differently from the file permission bits of special files
104 For regular files and directories the file
105 permission bits define access to the file's contents, while for device special
106 files they define access to the device described by the special file.
107 The file permissions of symbolic links are not used in access checks.
108 These differences would allow users to consume filesystem resources in
109 a way not controllable by disk quotas for group or world writable
110 special files and directories.
113 user extended attributes are allowed only for regular files and directories,
114 and access to user extended attributes is restricted to the
115 owner and to users with appropriate capabilities for directories with the
116 sticky bit set (see the
118 manual page for an explanation of the sticky bit).
119 .SS Filesystem differences
120 The kernel and the filesystem may place limits on the maximum number
121 and size of extended attributes that can be associated with a file.
122 The VFS-imposed limits on attribute names and values are 255 bytes
123 and 64\ kB, respectively.
124 The list of attribute names that
125 can be returned is also limited to 64\ kB
129 Some filesystems, such as Reiserfs (and, historically, ext2 and ext3),
130 require the filesystem to be mounted with the
132 mount option in order for user extended attributes to be used.
134 In the current ext2, ext3, and ext4 filesystem implementations,
135 the total bytes used by the names and values of all of a file's
136 extended attributes must fit in a single filesystem block (1024, 2048
137 or 4096 bytes, depending on the block size specified when the
138 filesystem was created).
140 In the Btrfs, XFS, and Reiserfs filesystem implementations, there is no
141 practical limit on the number of extended attributes
142 associated with a file, and the algorithms used to store extended
143 attribute information on disk are scalable.
145 In the JFS, XFS, and Reiserfs filesystem implementations,
146 the limit on bytes used in an EA value is the ceiling imposed by the VFS.
148 In the Btrfs filesystem implementation,
149 the total bytes used for the name, value, and implementation overhead bytes
150 is limited to the filesystem
152 value (16\ kB by default).
154 Extended attributes are not specified in POSIX.1, but some other systems
155 (e.g., the BSDs and Solaris) provide a similar feature.
157 Since the filesystems on which extended attributes are stored might also
158 be used on architectures with a different byte order and machine word
159 size, care should be taken to store attribute values in an
160 architecture-independent format.
162 This page was formerly named
165 .\" Andreas Gruenbacher,
166 .\" .RI < a.gruenbacher@bestbits.at >
167 .\" and the SGI XFS development team,
168 .\" .RI < linux-xfs@oss.sgi.com >.
174 .BR ioctl_iflags (2),
179 .BR capabilities (7),