Samba 4 真的尊重 Unix 文件 acls 吗?

Samba 4 真的尊重 Unix 文件 acls 吗?

在互联网上研究这个主题后,我得出的结论是 Samba 应该考虑 Unix 文件 acls。在我的测试中我发现了相反的情况。仅考虑 Unix 文件模式位,并忽略文件 acl。如果我最初的假设是正确的并且 Samba 确实尊重 Unix 文件 acls,那么我做错了什么。请参阅下面的设置并指出我做错了什么。

使用的发行版和 Samba 版本:Centos Linux 7;桑巴4.1.1

##### Server

# Create Linux users
useradd alice
useradd bob

# Create a directory to be shared; set ro permissions for alice using \
# file mode bits and rw permissions for bob using file acls
mkdir /home/smbshare
chown alice:alice /home/smbshare
chmod 0500 /home/smbshare
setfacl -m u:bob:rwx /home/smbshare
setfacl -m m:rwx /home/smbshare

# Create a file for testing purposes
echo 'Hello world!' > /home/smbshare/test.txt

# Add users to Samba database
pdbedit -a -u alice
pdbedit -a -u bob

# Define share in smb.conf and restart the smb daemon
vim /etc/samba/smb.conf
    comment = smbshare for alice(ro) and bob(rw)
    path = /home/smbshare
    browseable = yes
    writeable = yes
    valid users = alice bob

systemctl reload smb

# Set the SELinux permissions and open samba on firewall
chcon -R -t samba_share_t /home/smbshare

firewall-cmd --add-service=samba --permanent
firewall-cmd --reload


##### Client

# Create Linux users
useradd alice
useradd bob

# Mount the remote Samba share
mkdir /mnt/smbshare
mount -t cifs -o username=alice,password=pass //192.168.1.112/smbshare /mnt/smbshare

# Now test the permissions 
su - alice
cd /mnt/smbshare
cat test.txt        # shows the contents of test.txt, as expected
echo 'I am alice' > test2.txt   # permission denied, as expected
exit

su - bob
cd /mnt/smbshare    # permission denied -- ???? NOT AS EXPECTED
exit

# I think it doesn't matter under which user to mount, but just to be sure \
# I tried to mount using bob's credentials
umount /mnt/smbshare
mount -t cifs -o username=bob,password=pass //192.168.1.112/smbshare /mnt/smbshare

# After checking file permissions I got the same results as above: \
# alice have read-only permissions (as expected), bob have no access (NOT as expected)

相关内容