小编and*_*ora的帖子

硬链接、符号链接和 ACL 文件夹权限如何交互?

这对我来说有点难以实现,但我遇到了一种非常奇怪的行为,涉及ACL 扩展文件权限和硬/符号链接。我会尽力让我的问题简短明了,但我首先必须向您展示我目前情况的一个例子,因为我不知道发生了什么或它叫什么。


假设我们有一个有两个用户的系统,我们称他们为alice和bob,他们在一定程度上共享一个名为 的文件夹,stuff具有以下权限:

bob@server:~$ getfacl /home/stuff getfacl: 
Removing leading '/' from absolute path names
# file: home/stuff
# owner: alice
# group: bob 
user::rwx
group::-wx
other::---
default:user::rwx
default:user:bob:rwx
default:group::-wx
default:mask::rwx
default:other::---
Run Code Online (Sandbox Code Playgroud)

如您所见,该文件夹的所有者是alice,但 bob 可以在其中写入内容并使其可执行,以便alice可以在(+x 标志)中运行。但是,由于 ACL,每次 bob 将文件写入/复制到 时stuff,文件的权限都会发生更改,最终如下所示。bob假设我们在主目录中创建一个文件并将其移动到stuff.

bob@server:~$ touch myfile
bob@server:~$ chmod 777 myfile
bob@server:~$ ls -la myfile
-rwxrwxrwx 1 bob bob 0 myfile

bob@server:~$ mv myfile /home/stuff/myfile
bob@server:~$ …
Run Code Online (Sandbox Code Playgroud)

security acl permissions hard-link symlink

5
推荐指数
1
解决办法
3517
查看次数

标签 统计

acl ×1

hard-link ×1

permissions ×1

security ×1

symlink ×1