我在我的机器上运行一个虚拟机,并使用 sshfs(通过 fstab 自动安装)在虚拟机中安装了一个主机文件夹。
abc@xyz:/home/machine/test on /home/vm/test type fuse.sshfs (rw,relatime,user_id=0,group_id=0,allow_other)
那个文件夹有一个我想在 VM 中运行的可执行文件。但在运行该可执行文件之前,我还需要一些功能。所以我的脚本看起来像:
#!/bin/bash
# Some preprocessing.
sudo setcap CAP_DAC_OVERRIDE+ep /home/vm/test/my_exec
/home/vm/test/my_exec
但我遇到以下错误:
Failed to set capabilities on file `/home/vm/test/my_exec' (Operation not supported)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file
但是如果我在 VM 中复制可执行文件(比如/tmp/),那么它就可以正常工作。这是 sshfs 的已知限制还是我在这里遗漏了什么?
最佳答案
File capabilities在 Linux 上用 extended attributes 实现(特别是 security.capability
属性),并非所有文件系统都实现扩展属性。
sshfs
特别不是。
关于linux - SSHFS 上的 Setcap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57662358/