默认 acl 未在共享目录中产生我想要的权限

默认 acl 未在共享目录中产生我想要的权限

我正在尝试在 2 个用户之间共享一个目录。两个用户都应该总是对给定路径下的所有现有和新创建的文件和子目录具有 rw 权限。

我将两个用户添加到相同的 2 个组(用户 www 到组 www 和 zip,用户 zip 反之亦然)

这就是我所做的:

root@foo:/home/zip# mkdir -m 0775 testdir
root@foo:/home/zip# chown zip:zip testdir/
root@foo:/home/zip# chmod g+s testdir/
root@foo:/home/zip# ls -la
[...]
drwxrwsr-x  1 zip  zip             0 Jun 12 10:08 testdir

root@foo:/home/zip# getfacl testdir/
# file: testdir/
# owner: zip
# group: zip
# flags: -s-
user::rwx
group::rwx
other::r-x

root@foo:/home/zip# setfacl -R -d -m \
u::rwX,g::rwX,u:zip:rwX,g:zip:rwX,u:www:rwX,g:www:rwX,o::r,mask:rw testdir/

root@foo:/home/zip# getfacl testdir/
# file: testdir/
# owner: zip
# group: zip
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:user:www:rwx    #effective:rw-
default:user:zip:rwx    #effective:rw-
default:group::rwx      #effective:rw-
default:group:www:rwx   #effective:rw-
default:group:zip:rwx   #effective:rw-
default:mask::rw-
default:other::r--

但是,当我现在通过 sftp(用户 zip)上传文件时,我没有得到所需的结果。 sftp 进程的umask名称为0002.我/proc/$pid/status上传的时候查了一下。

案例一:上传权限为600的文件

root@foo:/home/zip/testdir# getfacl test.jpg
# file: test.jpg
# owner: zip
# group: zip
user::rw-
user:www:rwx        #effective:---
user:zip:rwx        #effective:---
group::rwx          #effective:---
group:www:rwx       #effective:---
group:zip:rwx       #effective:---
mask::---
other::---

我不明白为什么掩码是---并且有效权限是空的。至少指定的用户权限不应该有效吗?我做错了什么?

情况 2:上传文件660

root@foo:/home/zip/testdir# getfacl test2.jpg
# file: test2.jpg
# owner: zip
# group: zip
user::rw-
user:www:rwx        #effective:rw-
user:zip:rwx        #effective:rw-
group::rwx          #effective:rw-
group:www:rwx       #effective:rw-
group:zip:rwx       #effective:rw-
mask::rw-
other::---

所以这似乎工作正常。

这是一个btrfs (rw,relatime,compress=zlib:3,space_cache,subvolid=5,subvol=/) volume (kernel 5.4.0)

相关内容