linux - SSHFS 上的 Setcap

标签 linux virtual-machine sshfs linux-capabilities

我在我的机器上运行一个虚拟机,并使用 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/

相关文章:

c++ - 解密未找到函数重载错误消息

linux - 与 pthreads 和 stdc++ 的静态链接?

php - docker MySQL : create new user

linux - 在 GHC 编译的二进制文件中使用过多的神秘系统时间

macos - SSHFS 挂载远程 ssh 服务器导致段错误 : 11 on mac OS

c++ - 强制父进程收割子进程 <defunct>

c - 在 Ubuntu 16.04 上找不到 printf.c

java - 测量java中的能量消耗

python - 使用 Fabric run 命令安装 sshfs 失败

macos - 在远程机器 (Ubuntu) 上挂载本地目录 (Mac)