我是 linux 中的 ACL 的新手(但从 Windows 中知道它们),并且正在尝试为不同用户的主文件夹(mr_blue)中的文件夹设置写访问权限(对于 mr_green)。发生的情况是 mr_green 一直收到“Permission Denied”错误。我很确定我已经正确设置了所有内容,但是我不确定是我还是我的文件系统的配置......
这是 getfacl 返回的内容:
mr_blue@vps_machine:~$ whoami
mr_blue
mr_blue@vps_machine:~$ umask
0022
mr_blue@vps_machine:~$ getfacl shared_dir
# file: shared_dir
# owner: mr_blue
# group: mr_blue
user::rwx
user:mr_green:rwx
group::r-x
group:mr_green:rwx
mask::rwx
other::---
default:user::rwx
default:user:mr_green:rwx
default:group::r-x
default:group:mr_green:rwx
default:mask::rwx
default:other::---
mr_blue@vps_machine:~$ ls -al .
...
drwxrwx---+ 2 mr_blue mr_blue 4096 Dec 15 13:34 shared_dir
该文件夹的内容是:
mr_blue@vps_machine:~$ ls -al shared_dir
total 16
drwxrwx---+ 2 mr_blue mr_blue 4096 Dec 15 13:34 .
drwxr-x--- 21 mr_blue mr_blue 4096 Dec 15 11:58 ..
-rw-rwxr--+ 1 mr_blue mr_blue 6 Dec 15 16:42 ok.txt
mr_blue@vps_machine:~$ getfacl shared_dir/ok.txt
# file: shared_dir/ok.txt
# owner: mr_blue
# group: mr_blue
user::rw-
user:mr_green:rwx
group::r-x
group:mr_green:rwx
mask::rwx
other::r--
当我以 mr_green 身份登录时,出现 Permission Denied 错误:
mr_green@vps_machine:~$ whoami
mr_green
mr_green@vps_machine:~$ umask
0022
mr_green@vps_machine:~$ cat /home/mr_blue/shared_dir/ok.txt
cat: /home/mr_blue/shared_dir/ok.txt: Permission denied
在网上查看各种问题指标,似乎它应该可以正常工作......但我不明白为什么它不是。欢迎任何帮助或建议!
以下是可能相关的各种配置的结果:
# mount | grep vda1
/dev/vda1 on / type ext3 (rw,relatime,quota,usrquota,grpquota,errors=remount-ro,data=ordered)
# mount -v -o remount,acl /dev/vda1
mount: /dev/vda1 mounted on /.
# mount | grep vda1
/dev/vda1 on / type ext3 (rw,relatime,quota,usrquota,grpquota,errors=remount-ro,data=ordered)
# tune2fs -l /dev/vda1 | grep "Default mount options"
Default mount options: user_xattr acl
# cat /etc/fstab
...
UUID=xxx / ext3 defaults,acl,errors=remount-ro,rw,grpquota,usrquota 0
# cat /boot/config-4.4.0-170-generic | grep ACL
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_REISERFS_FS_POSIX_ACL=y
CONFIG_JFS_POSIX_ACL=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_FS_POSIX_ACL=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HFSPLUS_FS_POSIX_ACL=y
CONFIG_JFFS2_FS_POSIX_ACL=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFS_ACL_SUPPORT=m
CONFIG_CEPH_FS_POSIX_ACL=y
CONFIG_CIFS_ACL=y
CONFIG_9P_FS_POSIX_ACL=y
我注意到最后一个命令没有列出任何内容,CONFIG_EXT3...
所以它可能是一个原因......?但我不知道是不是这样,也不知道如何进行......