Update lfs-uefi.txt
[linux_from_scratch_hints.git] / OLD / acl.txt
blob28f84692f66561416e59fbffec142ffef55b165d
1 AUTHOR: Kelledin <kelledin@users.sourceforge.net>
2 DATE: 2003-09-06
3 LICENSE: GNU Free Documentation License
4 SYNOPSIS: Adding ACL support to your LFS
5 DESCRIPTION:
6 ACLs (Access Control Lists) are a means of fine-grained control of filesystem
7 access permissions.  These are useful not just for extending local filesystem
8 security on your Linux system, but also for serving Windows clients via samba.
10 PREREQUISITES: LFS-CVS-20030906 or later, kernel 2.4.21
12 HINT:
14 1. Background Information
15 ------------------------------------------------------------------------------
16 Access Control Lists (ACLs) are a means of providing fine-grained per-user
17 access control for files and directories.  The traditional UNIX method of
18 access control divides users into three categories: file owner, group members,
19 and everyone else.  Access control via POSIX ACLs can be achieved on an
20 individual user basis, effectively superseding the traditional UNIX access
21 control.
23 ACLs depend on Extended Attributes (EA) functionality, a means for certain
24 arbitrary pieces of metadata to be associated with files and directories.
25 Currently ACLs are the only major use of EAs in Linux.
27 Currently, Linux can support POSIX ACLs in ext2/3 and SGI's XFS.  ReiserFS,
28 however, will probably not get ACL support until Reiser4 (which is currently
29 experimental).
31 As far as networked filesystems go, samba servers can support ACLs when
32 working with Windows-based clients, but not Linux/UNIX-type clients.  Cross-
33 platform NFS support is even more tricky with ACLs.  Patches to extend the
34 current NFSv3 implementation are available from http://acl.bestbits.at/ ;
35 however, they are not covered here, and the full extent of their ACL support
36 is unknown.
39 2. Caveats
40 ------------------------------------------------------------------------------
41 It should be noted that some versions of ACL support don't play nice with
42 quota support in ext3.  You will likely have frequent lockups if you try to
43 use both at the same time.
45 It should also be noted that if you're using fileutils instead of the newer
46 coreutils, an ACL-enabled fileutils has a few quirks that break some shell
47 scripts.  This is because "ls -l" from an ACL-enabled fileutils will mark each
48 ACL-enabled entry with a "+" sign trailing after the traditional permissions
49 bits.  In short, instead of this:
51         -rw-r--r--   1 root     root        27173 Jun 12 02:41 filename
53 "ls -l" will print this instead:
55         -rw-r--r--+   1 root     root        27173 Jun 12 02:41 filename
57 Any shell script that parses the output of "ls -l" for itself is liable to not
58 expect that "+" sign.
60 coreutils-5.0 does not add this extra "+" sign.
63 3. Download
64 ------------------------------------------------------------------------------
65 In order to get ACL/EAs working, you will first need kernel patches.  You
66 should try to make this work with a recent (2.4.18+) kernel.  This hint
67 recommends and assumes that you use a reasonably vanilla 2.4.21 kernel.
69 If you plan to use ACLs with ext2/3, you need the following patch:
71     http://acl.bestbits.at/current/diff/ea+acl+nfsacl-2.4.21-0.8.60.diff.gz
74 If you plan to use ACLs with SGI XFS, you need the patches from:
76     ftp://oss.sgi.com/projects/xfs/Release-1.3.1/kernel_patches/ \
77         linux-2.4.21-core-xfs-1.3.1.patch.gz
78     ftp://oss.sgi.com/projects/xfs/Release-1.3.1/kernel_patches/ \
79         linux-xfs-1.3.1.patch.gz
81 It should be noted that as of Dec 8 2003, SGI XFS is integrated with the
82 vanilla Linux kernel.  2.4.24 should come with XFS support when it is released,
83 so the above XFS patches will likely be unnecessary.
85 You will also need userland libraries and utilities.  Thanks to the recent
86 ACL/EA syscall reservations, both XFS and ext2/3 ACLs are served by the same
87 packages.  However, the packages hosted at http://acl.bestbits.at are very
88 outdated.  It is recommended that you retrieve the packages from the SGI
89 FTP server:
91     ftp://oss.sgi.com/projects/xfs/cmd_tars/attr-2.4.12.src.tar.gz
92     ftp://oss.sgi.com/projects/xfs/cmd_tars/acl-2.2.21.src.tar.gz
95 You should also compile a version of coreutils that works with ACLs, so that
96 you don't lose ACL information with day-to-day file manipulation.  In addition
97 to the coreutils source package, you need the coreutils patchset for this:
99     http://acl.bestbits.at/current/diff/coreutils-5.0-0.tar.gz
102 4. Compile
103 ------------------------------------------------------------------------------
104 Now the fun really begins.
106 First, apply the necessary patches and compile a kernel with ACL support
107 (CONFIG_FS_POSIX_ACL=y).  This can be found under "Filesystems" when
108 using "make menuconfig."  For XFS, you may also need to enable certain
109 suboptions of XFS support, found in the same menu screen.
111 Once you've got the kernel compiled and installed, it may be necessary to copy
112 your new kernel headers to /usr/include/{linux,asm,asm-generic} all over again
113 (I hear FHS zealots wailing already).
115 For the next bit, compile the attr-2.4.12 libraries:
117     # set CFLAGS...
118     ./configure --prefix=/usr --enable-shared --enable-static &&
119     make OPTIMIZER="" DEBUG="-DNDEBUG" &&
120     make install install-lib install-dev &&
121     mv /usr/libexec/libattr.*a /lib &&
122     rm -f /usr/libexec/libattr.* /lib/libattr.so &&
123     ln -s ../../lib/libattr.so.1.1.0 /usr/lib/libattr.so
126 Now compile the acl-2.2.21 libraries:
128     # set CFLAGS...
129     ./configure --prefix=/usr --enable-shared --enable-static &&
130     make OPTIMIZER="" DEBUG="-DNDEBUG" &&
131     make install install-lib install-dev &&
132     mv /usr/libexec/libacl.*a /lib &&
133     rm -f /usr/libexec/libacl.*a /lib/libacl.so &&
134     ln -s ../../lib/libacl.so.1.1.0 /usr/lib/libacl.so
137 At this point, you should immediately be able to examine ACL's on an XFS
138 filesystem using getfacl and setfacl.
140 In order to enable ACLs on ext2/ext3, you will need to configure certain mount
141 options.  The "user_xattr" option enables user-accessible extended attributes;
142 the "acl" option enables ACL support.  You can either specify these options at
143 every mount (possibly via /etc/fstab) or make these options enabled-by-default
144 on a specific ext2/ext3 filesystem via tune2fs:
146     tune2fs -o user_xattr /dev/<fs-device>
147     tune2fs -o acl /dev/<fs-device>
149 Now you need to patch coreutils.  This is a bit complicated, as the coreutils
150 patchset from acl.bestbits.at is a disorganized mess.  I will assume you have
151 untarred the patchset in /usr/src:
153     # set CFLAGS...
154     patch -p1 < /usr/src/coreutils-5.0-0/coreutils-acl.diff &&
155     patch -p1 < /usr/src/coreutils-5.0-0/coreutils-acl+posix.diff &&
156     patch -p1 < /usr/src/coreutils-5.0-0/coreutils-xattr.diff &&
157     patch -p1 < /usr/src/coreutils-5.0-0/coreutils-i18n.patch &&
158     patch < /usr/src/coreutils-5.0-0/coreutils-5.0.dif &&
159     patch < /usr/src/coreutils-5.0-0/coreutils-tests.patch
162 Now you should compile coreutils according to the instructions in your favorite
163 version of the LFS book.
165 At some point, you may wish to compile samba with ACL support.  This is a
166 simple matter of passing the "--with-acl-support" flag to samba's configure
167 script.
170 5. Aftermath
171 ------------------------------------------------------------------------------
172 You should now be able to view and modify ACLs on an ACL-ready filesystem, by
173 way of the setfacl and getfacl utilities from the acl package.  coreutils will
174 not view or modify ACLs directly but will preserve them when moving, copying,
175 or creating files.
177 A properly compiled samba should be able to support ACLs over the network.
178 While samba servers aren't in the habit of providing even complete UNIX-style
179 permissions to UNIX/Linux clients, an ACL-enabled samba server is better
180 equipped to support Windows clients.
182 ------------------------------------------------------------------------------
184 CHANGELOG:
185 [2003-12-08]
186 * Updated with ext2/ext3 instructions (thanks to Daniel Thaler).
187 * Updated to support new SysV-free XFS 1.3.1 release.
188 * Updated to include newer versions of acl and attr.
190 [2003-09-06]
191 * Updated to support coreutils, linux-2.4.21, and recent new XFS 1.3 release.
192 * Rewrote to accommodate new hints format.