![对于SSHFS,目录和文件可以继承与父目录相同的权限吗?](https://linux22.com/image/227550/%E5%AF%B9%E4%BA%8ESSHFS%EF%BC%8C%E7%9B%AE%E5%BD%95%E5%92%8C%E6%96%87%E4%BB%B6%E5%8F%AF%E4%BB%A5%E7%BB%A7%E6%89%BF%E4%B8%8E%E7%88%B6%E7%9B%AE%E5%BD%95%E7%9B%B8%E5%90%8C%E7%9A%84%E6%9D%83%E9%99%90%E5%90%97%EF%BC%9F.png)
更进一步于此邮政,我发现如果权限other
应该是---
,那么我可以使用(它似乎有效):
setfacl -R -m d:o::0 test
但使用 SSHFS 时,权限不会保留。 UID 和GID 都被保留。我需要一个解决方案来处理 SSHFS 情况。
答案1
在调用 sshfs 时,您可以使用选项 : -o umask=0007
: 来确保其他选项的“rwx”位全部未设置。
The defaults rights (not mask!) are:
octal: 0755 for a directory
0644 for files
binary: 000 111 101 101 for a directory
000 110 100 100 for a file
ie: --- rwx r-x r-x for a directory
--- rw- r-- r-- for a file
(note: the first octal digit is for: 'setuid', 'setgid', and 'sticky' bits)
The umask will MASK some of those bits.
umask 0007: 000 000 000 111
the original bits are ANDed one by one with the corresponding bit in the mask:
| bitA | bitB | bitA AND bitB |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
So with umask 0027, the defaults rights shown above will result in:
binary: 000 111 101 000 for a directory
000 110 100 000 for a file
ie: --- rwx r-x --- for a directory
--- rw- r-- --- for a file