bash 使用 setfacl 后权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22874094/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Permission denied after using setfacl
提问by filippo
There are 3 users: A, B, C.
有 3 个用户:A、B、C。
Ahas mydir in his home folder /home/A/mydir
A在他的主文件夹中有 mydir/home/A/mydir
Bcan read /home/A
contents
B可以读取/home/A
内容
Ccan read and write /home/A
contents
C可以读写/home/A
内容
I tried in this way:
我这样试过:
setfacl -Rm u:B:r /home/A/
setfacl -Rm u:C:rw /home/A/
su B
ls /home/A
ls: cannot access /home/A: Permission denied
mydir
cd /home/A
-bash: cd: /home/A/: Permission denied
cat /etc/fstabs:
猫 /etc/fstab:
/dev/sdb1 /media/esterno ext3 defaults,acl 0 2
/dev/sdb1 /media/esterno ext3 默认值,acl 0 2
getfacl /home/A:
getfacl /home/A:
getfacl: Removing leading '/' from absolute path names
# file: home/A
# owner: A
# group: A
user::rwx
user:B:r--
user:C:rw-
group::---
mask::rw-
other::---
回答by mofoe
As tampisallready said, to change into a directory (or list its content, or read a file in it) in linux, one needs to have execute permissions on that directory.
Change your setfacl
commad to something like this:
正如tampis所说,要在linux中切换到目录(或列出其内容,或读取其中的文件),需要对该目录具有执行权限。将您的setfacl
命令更改为如下所示:
setfacl -Rm u:B:rx /home/A/
setfacl -Rm u:C:rwx /home/A/
回答by Shivam Mehrotra
you also need execute permission along with read permission on directory
您还需要执行权限以及目录的读取权限
"setfacl -m u:B:r-x /home/A"