我在我的机器上运行一个VM,并且已经使用sshfs (通过fstab自动挂载)在VM内挂载了一个主机文件夹。
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的一个已知限制,还是我在这里遗漏了什么?
发布于 2019-08-27 01:38:50
File capabilities是使用extended attributes (具体地说是security.capability属性)在Linux上实现的,并不是所有的文件系统都实现扩展属性。
尤其是sshfs没有。
发布于 2019-08-27 01:45:28
sshfs只能执行远程用户有权执行的操作。您以abc身份登录到远程主机,因此只能对abc可以执行的sshfs执行操作--不包括setcap,因为该操作只能由根用户执行。在本地机器上使用sudo不会改变这一点。
https://stackoverflow.com/questions/57662358
复制相似问题