ACL 未启用但它正在工作

sla*_*bin 5 acl debian mount fstab

这怎么可能?

  1. 中未启用 ACL /etc/fstab,我可以通过手动打开fstab或运行sudo mount | grep -i acl.

  2. 但是getfacl&setfacl命令可以毫无怨言地工作!

问题是,首先我需要了解为什么这是有效的,其次我需要检查其他系统以查看它们是否支持 ACL,那么我该怎么做呢?

ACL 命令在/&上都进行了测试/mydrivemount输出见下文)。

操作系统信息:

uname -a
Linux localhost 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u1 x86_64 GNU/Linux

lsb_release -a
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 7.5 (wheezy) Release: 7.5 Codename: wheezy

mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=384309,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=308664k,mode=755) /dev/disk/by-uuid/3180f94a-e765-44e9-93f7-33aa1c6422c0 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1188500k) /dev/sda5 on /mydrive type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered) rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime) fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)

Sté*_*las 14

ext 3/4文件系统在其标头中有一个默认的挂载选项属性。你可以看到它:

$ LC_ALL=C tune2fs -l /dev/device | grep 'Default mount options:'
Default mount options:    user_xattr acl
Run Code Online (Sandbox Code Playgroud)

您可以更改它tune2fs -o并安装-o noacl将覆盖它。

创建新文件系统时,mke2fs将根据您在/etc/mke2fs.conf. 例如,我的有:

[defaults]
[...]
        default_mntopts = acl,user_xattr
[...]
Run Code Online (Sandbox Code Playgroud)

但是,正如Gilles指出的,自 2.6.39 起,acl并且user_xattr默认情况下处于启用状态(前提是在编译时内核中启用了支持,这通常是默认设置)。因此,即使没有acl默认挂载选项,acls 也会在较新的内核上默认启用,而禁用它的唯一方法是使用mount -o noacl.

要检查是否支持 ACL,最好尝试查询它们:

$ chacl -l /the/mountpoint
chacl: cannot get access ACL on '/the/mountpoint': Operation not supported
Run Code Online (Sandbox Code Playgroud)