有点困难:如何在 zfs/nfsv4 acl 上复制 posix acl 默认值?

有点困难:如何在 zfs/nfsv4 acl 上复制 posix acl 默认值?

假设我想要一个目录,其中创建的所有文件和目录都具有该目录的组所有者的组权限,并且默认权限为770。使用 posix ACL 真的很容易

#create a dir..
mkdir proof

#inherit group permission "video" in this example
chmod g+s proof/
chgrp video proof/

#with setfacl make the default group with rxw permissions
setfacl -d -m g:video:rwx proof

#other are not allowed
setfacl -d -m o:--- proof/
chmod o-x proof

#give the acl
setfacl -m g:video:rwx proof

现在我在目录证明中创建一个文件和一个目录。

mkdir try1
drwxrws---+ 2 myuser video 4,0K feb 23 01:26 try1
touch file1
-rw-rw----+ 1 myuser video    0 feb 23 01:29 file1

正如您所看到的,我获得了我想要的内容,目录中的所有文件都继承权限,并将组“video”作为组所有者。这在 Linux(ext4 上的 posix acl、btrfs 等)和 Solaris (ufs) 上是可能的。

现在的问题是……如何在 Solaris 上使用 nfsv4 acl 的 zfs 执行此操作?我尝试过在 zfs Solaris 11 主机中制作另一个目录“证明”(当然 chmod g+s 已制作)

chmod A=owner@:read_attributes/read_data/execute/list_directory/read_data/write_data/append_data/execute/add_file/add_subdirectory:fd:allow,group:video:read_attributes/read_data/execute/list_directory/read_data/write_data/append_data/execute/add_file/add_subdirectory:fd:allow,everyone@:read_attributes/read_data/execute/list_directory/read_data/write_data/append_data/execute/add_file/add_subdirectory:fd:deny proof

但结果是..

mkdir newdir
drwxr-sr-x+ 2 myuser video 2 23 feb 02.33 newdir

:|

如何获得相同的posix acl?谢谢

答案1

找到解决方案,我想要 770 for user+groupvideo

a)创建zfs卷

zfs create proof1

b)非常重要,否则不起作用!

zfs set aclinherit=passthrough rpool/proof1

c)现在是acl

chmod g+s /proof1
chgrp video /proof1

#this if you don't share the dir via nfs
chmod A=owner@:full_set:fd:allow,group:video:full_set:fd:allow,everyone@:full_set:fd:deny /proof1

#this if you want to share it via nfs
chmod A=owner@:full_set:fd:allow,group:video:full_set:fd:allow,everyone@:read_set:allow /proof1

fd 表示文件和目录继承

d)我创建文件...和目录

mkdir dir1 
touch file1

drwxrws---+ 2 root video 2 23 feb 02.59 dir1
-rwxrwx---+ 1 root video 0 23 feb 02.59 file1

完美的。我通过本地文件进行测试,只有属于视频组的用户才能在目录上写入。

相关内容