JavaScript is required to for searching.
跳过导航链接
退出打印视图
Oracle Solaris ZFS 管理指南     Oracle Solaris 10 8/11 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  Oracle Solaris ZFS 文件系统(介绍)

2.  Oracle Solaris ZFS 入门

3.  Oracle Solaris ZFS 与传统文件系统之间的差别

4.  管理 Oracle Solaris ZFS 存储池

5.  安装和引导 Oracle Solaris ZFS 根文件系统

6.  管理 Oracle Solaris ZFS 文件系统

7.  使用 Oracle Solaris ZFS 快照和克隆

8.  使用 ACL 和属性保护 Oracle Solaris ZFS 文件

新 Solaris ACL 模型

ACL 设置语法的说明

ACL 继承

ACL 属性 (aclinherit)

设置 ZFS 文件的 ACL

以详细格式设置和显示 ZFS 文件的 ACL

以详细格式设置 ZFS 文件的 ACL 继承

以缩写格式设置和显示 ZFS 文件的 ACL

9.  Oracle Solaris ZFS 委托管理

10.  Oracle Solaris ZFS 高级主题

11.  Oracle Solaris ZFS 故障排除和池恢复

A.  Oracle Solaris ZFS 版本说明

索引

以缩写格式设置和显示 ZFS 文件的 ACL

可通过使用 14 个唯一字母表示权限的缩写格式来设置和显示 ZFS 文件的权限。表 8-2表 8-3 列出了表示缩写权限的字母。

可以使用 ls -V 命令显示用于文件和目录的缩写 ACL 列表。例如:

# ls -V file.1
-rw-r--r--   1 root     root      206663 Jun 23 15:06 file.1
            owner@:rw-p--aARWcCos:------:allow
            group@:r-----a-R-c--s:------:allow
         everyone@:r-----a-R-c--s:------:allow

以下介绍了缩写的 ACL 输出:

owner@

所有者可以读取和修改文件的内容(rw=read_data/write_datap=append_data)。所有者还可以修改文件的属性,如时间戳、扩展属性和 ACL(a=read_attributes A=write_xattrR= read_xattrW=write_attributesc=read_aclC=write_acl)。此外,所有者还可以修改文件的所有权 (o=write_owner)。

synchronize 访问权限当前未实现。

group@

向组授予对文件的读取权限(r= read_data) 和对文件属性的读取权限 (a=read_attributes R=read_xattrc= read_acl)。

synchronize 访问权限当前未实现。

everyone@

向用户或组之外的所有人员授予对文件以及文件属性的读取权限(r=read_dataa=append_dataR=read_xattrc=read_acls=synchronize)。

synchronize 访问权限当前未实现。

与详细 ACL 格式相比,缩写 ACL 格式具有以下优点:

有关使用详细 ACL 格式的信息,请参见以详细格式设置和显示 ZFS 文件的 ACL

示例 8-10 以缩写格式设置和显示 ACL

在以下示例中,file.1 存在普通 ACL:

# ls -V file.1
-rw-r--r--   1 root     root      206663 Jun 23 15:06 file.1
            owner@:rw-p--aARWcCos:------:allow
            group@:r-----a-R-c--s:------:allow
         everyone@:r-----a-R-c--s:------:allow

在本示例中,为用户 gozer 添加了对 file.1read_data/execute 权限。

# chmod A+user:gozer:rx:allow file.1
# ls -V file.1
-rw-r--r--+  1 root     root      206663 Jun 23 15:06 file.1
        user:gozer:r-x-----------:------:allow
            owner@:rw-p--aARWcCos:------:allow
            group@:r-----a-R-c--s:------:allow
         everyone@:r-----a-R-c--s:------:allow

在以下示例中,通过使用缩写 ACL 格式向用户 gozer 授予了在新创建文件和目录时会继承的读取、写入和执行权限。

# chmod A+user:gozer:rwx:fd:allow dir.2
# ls -dV dir.2
drwxr-xr-x+  2 root     root           2 Jun 23 16:04 dir.2
        user:gozer:rwx-----------:fd----:allow
            owner@:rwxp--aARWcCos:------:allow
            group@:r-x---a-R-c--s:------:allow
         everyone@:r-x---a-R-c--s:------:allow

另外,还可以剪切 ls -V 输出中的权限和继承标志并将其粘贴到缩写的 chmod 格式中。例如,要将用户 gozerdir.2 的权限和继承标志复制给用户 cindy,可将权限和继承标志 (rwx-----------:fd----:allow ) 复制并粘贴到 chmod 命令中。例如:

# chmod A+user:cindy:rwx-----------:fd----:allow dir.2
# ls -dV dir.2
drwxr-xr-x+  2 root     root           2 Jun 23 16:04 dir.2
       user:cindy:rwx-----------:fd----:allow
        user:gozer:rwx-----------:fd----:allow
            owner@:rwxp--aARWcCos:------:allow
            group@:r-x---a-R-c--s:------:allow
         everyone@:r-x---a-R-c--s:------:allow

示例 8-11 ACL 继承模式设置为 Passthrough 时的 ACL 继承

aclinherit 属性设置为 passthrough 的文件系统会继承所有可继承 ACL 项,并且继承 ACL 项时不会对其进行任何修改。当此属性设置为 passthrough 时,会使用由可继承 ACE 确定的权限模式来创建文件。如果不存在影响权限模式的可继承 ACE,则会根据应用程序要求的模式设置权限模式。

以下示例使用缩写 ACL 语法来说明如何通过将 aclinherit 模式设置为 passthrough 来继承权限位。

在本示例中,对 test1.dir 设置了 ACL 以强制继承。该语法会为新创建的文件创建 owner@group@everyone@ ACL 项。新创建的目录会继承 @ownergroup@everyone@ ACL 项。

# zfs set aclinherit=passthrough tank/cindy
# pwd
/tank/cindy
# mkdir test1.dir
# chmod A=owner@:rwxpcCosRrWaAdD:fd:allow,group@:rwxp:fd:allow,everyone@::fd:allow test1.dir
# ls -Vd test1.dir
drwxrwx---+  2 root     root           2 Jun 23 16:10 test1.dir
            owner@:rwxpdDaARWcCos:fd----:allow
            group@:rwxp----------:fd----:allow
         everyone@:--------------:fd----:allow

在此示例中,新创建的文件会继承指定继承到新创建的文件的 ACL。

# cd test1.dir
# touch file.1
# ls -V file.1
-rwxrwx---+  1 root     root           0 Jun 23 16:11 file.1
            owner@:rwxpdDaARWcCos:------:allow
            group@:rwxp----------:------:allow
         everyone@:--------------:------:allow

在本示例中,新创建的目录会继承用于控制此目录访问权限的 ACE 以及将来传播到新创建目录的子项的 ACE。

# mkdir subdir.1
# ls -dV subdir.1
drwxrwx---+  2 root     root           2 Jun 23 16:13 subdir.1
            owner@:rwxpdDaARWcCos:fd----:allow
            group@:rwxp----------:fd----:allow
         everyone@:--------------:fd----:allow

fd---- 项用于传播继承,在访问控制期间不会被考虑。在本示例中,在不存在继承 ACE 的另一目录中使用普通 ACL 创建了一个文件。

# cd /tank/cindy
# mkdir test2.dir
# cd test2.dir
# touch file.2
# ls -V file.2
-rw-r--r--   1 root     root           0 Jun 23 16:15 file.2
            owner@:rw-p--aARWcCos:------:allow
            group@:r-----a-R-c--s:------:allow
         everyone@:r-----a-R-c--s:------:allow

示例 8-12 ACL 继承模式设置为 Passthrough-X 时的 ACL 继承

如果启用 aclinherit=passthrough-x,对于 owner@group@everyone@ 设置,将使用执行 (x) 权限创建文件,但是只有在文件创建模式以及影响该模式的可继承 ACE 中设置执行权限才行。

以下示例说明了如何通过将 aclinherit 模式设置为 passthrough-x 来继承执行权限。

# zfs set aclinherit=passthrough-x tank/cindy

/tank/cindy/test1.dir 上设置了以下 ACL,以便为 owner@ 的文件提供可执行 ACL 继承。

# chmod A=owner@:rwxpcCosRrWaAdD:fd:allow,group@:rwxp:fd:allow,everyone@::fd:allow test1.dir
# ls -Vd test1.dir
drwxrwx---+  2 root     root           2 Jun 23 16:17 test1.dir
            owner@:rwxpdDaARWcCos:fd----:allow
            group@:rwxp----------:fd----:allow
         everyone@:--------------:fd----:allow

使用请求的权限 0666 创建文件 (file1),但生成的权限为 0660。没有继承执行权限的原因是,创建模式未请求该权限。

# touch test1.dir/file1
# ls -V test1.dir/file1
-rw-rw----+  1 root     root           0 Jun 23 16:18 test1.dir/file1
            owner@:rw-pdDaARWcCos:------:allow
            group@:rw-p----------:------:allow
         everyone@:--------------:------:allow

接下来,在 testdir 目录下使用 cc 编译器来生成名为 t 的可执行文件。

# cc -o t t.c
# ls -V t
-rwxrwx---+  1 root     root        7396 Dec  3 15:19 t
                 owner@:rwxpdDaARWcCos:------:allow
                 group@:rwxp----------:------:allow
              everyone@:--------------:------:allow

生成的权限为 0770,这是因为 cc 请求了权限 0777,这导致从 owner@group@everyone@ 条目继承了执行权限。