Wednesday, February 12, 2014

ZFC ACL Journal

Create Sub Folder
# mkdir acltest1
# ls -dv acltest1
drwxr-xr-x   2 root     root           2 Jan 22 12:42 acltest1
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

#  chmod A+user:feijiangnan:read_data/write_data/execute:allow acltest1

# ls -dv acltest1
drwxr-xr-x+  2 root     root           2 Jan 22 12:42 acltest1
     0:user:feijiangnan:list_directory/read_data/add_file/write_data/execute:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
# mkdir acltest1/subdir
# ls -dv acltest1/subdir
drwxr-xr-x   2 root     root           2 Jan 22 13:41 acltest/subdir
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

Granting ACL Inheritance on Files and Directories
# mkdir acltest2
# ls -dv acltest2
drwxr-xr-x   2 root     root           2 Jan 22 13:44 acltest2
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
# chmod A+user:feijiangnan:read_data/write_data/execute:allow acltest2

# chmod A+user:feijiangnan:read_data/write_data/execute:file_inherit/dir_inherit:allow acltest2

chmod A+user:jlopez3:read_data/write_data/execute:file_inherit/dir_inherit:allow acltest2

# ls -dv acltest2
drwxr-xr-x+  2 root     root           2 Jan 22 14:10 acltest2
     0:user:feijiangnan:list_directory/read_data/add_file/write_data/execute
         :file_inherit/dir_inherit:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

# mkdir acltest2/subdir
# ls -dv acltest2/subdir
drwxr-xr-x+  2 root     root           2 Jan 22 14:13 acltest2/subdir
     0:user:feijiangnan:list_directory/read_data/execute:file_inherit/dir_inherit
         /inherited:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

# chmod A+user:feijiangnan:read_data/write_data:dir_inherit:allow acltest2
# mkdir acltest2/subdir
# ls -dv acltest2/subdir
drwxr-xr-x+  2 root     root           2 Jan 22 14:03 acltest2/subdir
     0:user:feijiangnan:list_directory/read_data:dir_inherit/inherited:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

Owner inherit ACL from parents directory.
# zfs set aclmode=mask pond/whoville

# zfs set aclinherit=restricted pond/whoville

root@biserver:~# zfs get aclinherit rpool/export/home/feijiangnan
NAME                    PROPERTY    VALUE       SOURCE
rpool/export/home/feijiangnan  aclinherit  restricted  default
root@biserver:~# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE    SOURCE
rpool/export/home/feijiangnan  aclmode   discard  default
root@biserver:~#

# chmod A+group:dba:modify_set:allow acltest1

# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE        SOURCE
rpool/export/home/feijiangnan  aclmode   discard  default

# zfs set aclmode=passthrough rpool/export/home/feijiangnan

# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE        SOURCE
rpool/export/home/feijiangnan  aclmode   passthrough  local

No comments:

Post a Comment