1ATTR(5)                       File Formats Manual                      ATTR(5)
2
3
4

NAME

6       attr - Extended attributes
7

DESCRIPTION

9       Extended  attributes  are  name:value pairs associated permanently with
10       files and directories, similar to the  environment  strings  associated
11       with  a  process.   An attribute may be defined or undefined.  If it is
12       defined, its value may be empty or non-empty.
13
14       Extended attributes are extensions to the normal attributes  which  are
15       associated with all inodes in the system (i.e. the stat(2) data).  They
16       are often used to provide additional functionality to  a  filesystem  -
17       for  example, additional security features such as Access Control Lists
18       (ACLs) may be implemented using extended attributes.
19
20       Users with search access to a file or directory may retrieve a list  of
21       attribute names defined for that file or directory.
22
23       Extended  attributes are accessed as atomic objects.  Reading retrieves
24       the whole value of an attribute and stores it  in  a  buffer.   Writing
25       replaces any previous value with the new value.
26
27       Space consumed for extended attributes is counted towards the disk quo‐
28       tas of the file owner and file group.
29
30       Currently, support for extended attributes is implemented on  Linux  by
31       the ext2, ext3 and XFS filesystem patches, which can be downloaded from
32       http://acl.bestbits.at/  and  http://oss.sgi.com/projects/xfs/  respec‐
33       tively.
34

EXTENDED ATTRIBUTE NAMESPACES

36       Attribute  names  are  zero-terminated  strings.  The attribute name is
37       always specified in the fully qualified namespace.attribute  form,  eg.
38       user.mime_type,   trusted.md5sum,   system.posix_acl_access,  or  secu‐
39       rity.selinux.
40
41       The namespace mechanism is used to define different classes of extended
42       attributes.   These  different  classes exist for several reasons, e.g.
43       the permissions and capabilities  required  for  manipulating  extended
44       attributes of one namespace may differ to another.
45
46       Currently  the  security,  system, trusted, and user extended attribute
47       classes are defined as described below. Additional classes may be added
48       in the future.
49
50   Extended security attributes
51       The  security  attribute  namespace is used by kernel security modules,
52       such as Security Enhanced Linux.  Read and write access permissions  to
53       security  attributes depend on the policy implemented for each security
54       attribute by the security module.  When no security module  is  loaded,
55       all  processes  have  read  access to extended security attributes, and
56       write access is limited to processes that have the CAP_SYS_ADMIN  capa‐
57       bility.
58
59   Extended system attributes
60       Extended  system  attributes  are  used  by  the kernel to store system
61       objects such as Access Control Lists and Capabilities.  Read and  write
62       access  permissions  to  system  attributes depend on the policy imple‐
63       mented for each system attribute implemented by filesystems in the ker‐
64       nel.
65
66   Trusted extended attributes
67       Trusted  extended  attributes  are  visible and accessible only to pro‐
68       cesses that have the CAP_SYS_ADMIN capability (the super  user  usually
69       has  this  capability).  Attributes in this class are used to implement
70       mechanisms in user space (i.e., outside the kernel) which keep informa‐
71       tion in extended attributes to which ordinary processes should not have
72       access.
73
74   Extended user attributes
75       Extended user attributes may be assigned to files and  directories  for
76       storing arbitrary additional information such as the mime type, charac‐
77       ter set or  encoding  of  a  file.  The  access  permissions  for  user
78       attributes are defined by the file permission bits.
79
80       The  file  permission  bits of regular files and directories are inter‐
81       preted differently from the file permission bits of special  files  and
82       symbolic  links.  For regular files and directories the file permission
83       bits define access to the file's contents,  while  for  device  special
84       files  they  define access to the device described by the special file.
85       The file permissions of symbolic links are not used in  access  checks.
86       These  differences would allow users to consume filesystem resources in
87       a way not controllable by disk quotas for group or world writable  spe‐
88       cial files and directories.
89
90       For  this reason, extended user attributes are only allowed for regular
91       files and directories,  and  access  to  extended  user  attributes  is
92       restricted  to the owner and to users with appropriate capabilities for
93       directories with the sticky bit set (see the chmod(1) manual  page  for
94       an explanation of Sticky Directories).
95

FILESYSTEM DIFFERENCES

97       The  kernel  and  the filesystem may place limits on the maximum number
98       and size of extended attributes that can be associated with a file.
99
100       In the current ext2 and ext3 filesystem implementations,  all  extended
101       attributes  must  fit  on a single filesystem block (1024, 2048 or 4096
102       bytes, depending on the block size specified when  the  filesystem  was
103       created). This limit may be removed in a future version.
104
105       In  the  XFS  filesystem implementation, there is no practical limit on
106       the number of extended attributes associated with a file, and the algo‐
107       rithms  used  to store extended attribute information on disk are scal‐
108       able (stored either inline in the inode, as  an  extent,  or  in  a  B+
109       tree).
110

ADDITIONAL NOTES

112       Since  the  filesystems  on  which extended attributes are stored might
113       also be used on architectures with a different byte order  and  machine
114       word  size, care should be taken to store attribute values in an archi‐
115       tecture independent format.
116

AUTHORS

118       Andreas Gruenbacher, <a.gruenbacher@bestbits.at> and the SGI XFS devel‐
119       opment team, <linux-xfs@oss.sgi.com>.
120

SEE ALSO

122       getfattr(1), setfattr(1).
123
124
125
126                                                                       ATTR(5)
Impressum