]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/attr.7
attr.7: ffix
[thirdparty/man-pages.git] / man7 / attr.7
CommitLineData
544a5910
AG
1.\" Extended attributes manual page
2.\"
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.
6.\"
7.\" This is free documentation; you can redistribute it and/or
8.\" modify it under the terms of the GNU General Public License as
9.\" published by the Free Software Foundation; either version 2 of
10.\" the License, or (at your option) any later version.
11.\"
12.\" The GNU General Public License's references to "object code"
13.\" and "executables" are to be interpreted as the output of any
14.\" document formatting or typesetting system, including
15.\" intermediate and printed output.
16.\"
17.\" This manual is distributed in the hope that it will be useful,
18.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.\" GNU General Public License for more details.
21.\"
22.\" You should have received a copy of the GNU General Public
23.\" License along with this manual. If not, see
24.\" <http://www.gnu.org/licenses/>.
25.\"
26.TH ATTR 5
27.SH NAME
28attr - Extended attributes
29.SH DESCRIPTION
30Extended attributes are name:value pairs associated permanently with
31files and directories, similar to the environment strings associated
32with a process.
33An attribute may be defined or undefined.
34If it is defined, its value may be empty or non-empty.
35.PP
36Extended attributes are extensions to the normal attributes which are
ebce8403 37associated with all inodes in the system (i.e., the
544a5910
AG
38.BR stat (2)
39data).
40They are often used to provide additional functionality
ca7d9e34 41to a filesystem\(emfor example, additional security features such as
544a5910
AG
42Access Control Lists (ACLs) may be implemented using extended attributes.
43.PP
44Users with search access to a file or directory may retrieve a list of
45attribute names defined for that file or directory.
46.PP
47Extended attributes are accessed as atomic objects.
48Reading retrieves the whole value of an attribute and stores it in a buffer.
49Writing replaces any previous value with the new value.
50.PP
51Space consumed for extended attributes is counted towards the disk quotas
52of the file owner and file group.
53.PP
b68d4dc3
MK
54Currently, the filesystems that support extended attributes include
55Btrfs, ext2, ext3, ext4, XFS, JFS, and Reiserfs.
b63436d8 56.SS Extended attribute namespaces
68d53b6d 57Attribute names are null-terminated strings.
544a5910
AG
58The attribute name is always specified in the fully qualified
59.IR namespace.attribute
ebce8403 60form, for example,
544a5910
AG
61.IR user.mime_type ,
62.IR trusted.md5sum ,
63.IR system.posix_acl_access ,
64or
65.IR security.selinux .
66.PP
67The namespace mechanism is used to define different classes of extended
68attributes.
ebce8403
MK
69These different classes exist for several reasons;
70for example, the permissions
544a5910
AG
71and capabilities required for manipulating extended attributes of one
72namespace may differ to another.
73.PP
ca7d9e34 74Currently, the
544a5910
AG
75.IR security ,
76.IR system ,
77.IR trusted ,
78and
79.IR user
933e4675
MK
80extended attribute classes are defined as described below.
81Additional classes may be added in the future.
544a5910
AG
82.SS Extended security attributes
83The security attribute namespace is used by kernel security modules,
d8ba7694
MK
84such as Security Enhanced Linux, and also to implement file capabilities (see
85.BR capabilities (7)).
544a5910
AG
86Read and write access permissions to security attributes depend on the
87policy implemented for each security attribute by the security module.
88When no security module is loaded, all processes have read access to
89extended security attributes, and write access is limited to processes
5ee7f61c
MK
90that have the
91.B CAP_SYS_ADMIN
92capability.
544a5910
AG
93.SS Extended system attributes
94Extended system attributes are used by the kernel to store system
d8ba7694 95objects such as Access Control Lists.
933e4675 96Read and write
544a5910
AG
97access permissions to system attributes depend on the policy implemented
98for each system attribute implemented by filesystems in the kernel.
99.SS Trusted extended attributes
100Trusted extended attributes are visible and accessible only to processes that
5ee7f61c
MK
101have the
102.B CAP_SYS_ADMIN
b4a61f89 103capability.
544a5910
AG
104Attributes in this class are used to implement mechanisms in user
105space (i.e., outside the kernel) which keep information in extended attributes
106to which ordinary processes should not have access.
107.SS Extended user attributes
108Extended user attributes may be assigned to files and directories for
109storing arbitrary additional information such as the mime type,
933e4675
MK
110character set or encoding of a file.
111The access permissions for user
544a5910
AG
112attributes are defined by the file permission bits.
113.PP
114The file permission bits of regular files and directories are
115interpreted differently from the file permission bits of special files
933e4675
MK
116and symbolic links.
117For regular files and directories the file
544a5910
AG
118permission bits define access to the file's contents, while for device special
119files they define access to the device described by the special file.
933e4675
MK
120The file permissions of symbolic links are not used in access checks.
121These differences would allow users to consume filesystem resources in
122a way not controllable by disk quotas for group or world writable
123special files and directories.
544a5910 124.PP
933e4675 125For this reason,
355657c2 126extended user attributes are allowed only for regular files and directories,
933e4675 127and access to extended user attributes is restricted to the
544a5910
AG
128owner and to users with appropriate capabilities for directories with the
129sticky bit set (see the
130.BR chmod (1)
131manual page for an explanation of Sticky Directories).
b63436d8 132.SS Filesystem differences
544a5910
AG
133The kernel and the filesystem may place limits on the maximum number
134and size of extended attributes that can be associated with a file.
8d75a7a8 135Some filesystems, such as ext2/3 and Reiserfs, require the filesystem
544a5910
AG
136to be mounted with the
137.B user_xattr
138mount option in order for extended user attributes to be used.
139.PP
140In the current ext2, ext3 and ext4 filesystem implementations, each
141extended attribute must fit on a single filesystem block (1024, 2048
142or 4096 bytes, depending on the block size specified when the
143filesystem was created).
144.PP
b68d4dc3 145In the Btrfs, XFS, and Reiserfs filesystem implementations, there is no
544a5910
AG
146practical limit on the number or size of extended attributes
147associated with a file, and the algorithms used to store extended
148attribute information on disk are scalable.
149.PP
150In the JFS filesystem implementation, names can be up to 255 bytes and
151values up to 65,535 bytes.
b124a27b
MK
152.SH CONFORMING TO
153Extended attributes are not specified in POSIX.1, but some other systems
154(e.g., the BSDs and Solaris) provide a similar feature.
7ee629ab 155.SH NOTES
544a5910
AG
156Since the filesystems on which extended attributes are stored might also
157be used on architectures with a different byte order and machine word
5871fb36
MK
158size, care should be taken to store attribute values in an
159architecture-independent format.
31a369b8
MK
160.\" .SH AUTHORS
161.\" Andreas Gruenbacher,
162.\" .RI < a.gruenbacher@bestbits.at >
163.\" and the SGI XFS development team,
164.\" .RI < linux-xfs@oss.sgi.com >.
544a5910 165.SH SEE ALSO
5ee7f61c 166.BR getfattr (1),
aad5c297
MK
167.BR setfattr (1),
168.BR getxattr (2),
169.BR listxattr (2),
170.BR removexattr (2),
171.BR setxattr (2),
172.BR acl (5),
173.BR capabilities (7)