在 sshfs 的 fstab 中忽略了“exec”选项,需要在命令行上指定为“mount”?

Dav*_*lar 9 ubuntu mount fstab sshfs

我在 fstab 中使用 sshfs 在 Ubuntu 18.04.04 LTS 中挂载文件系统:

sshfs#dave@myservergoeshere.com:/remote-dir /mnt/local-mnt  fuse    rw,exec,user,allow_other,noauto,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3  0 0
Run Code Online (Sandbox Code Playgroud)

它安装得很好,但是如果我尝试在路径中执行任何操作,我会得到:

./some-executable: Permission denied.
Run Code Online (Sandbox Code Playgroud)

该文件具有执行权限(如果我确实通过 ssh 进入系统,则可以正常工作)。

如果我使用 fstab 但再次包含 -oexec 选项:

mount /mnt/local-mnt -oexec
Run Code Online (Sandbox Code Playgroud)

然后它起作用了。为什么 fstab 'exec' 被忽略?

ste*_*ver 16

exec选项没有被忽略 - 它被noexec与后续user选项关联的隐式覆盖。这种行为在man mount

   user   Allow an ordinary user to mount the filesystem.  The name of the
          mounting user is written to the mtab file  (or  to  the  private
          libmount  file  in /run/mount on systems without a regular mtab)
          so that this same user can unmount the filesystem  again.   This
          option  implies  the  options  noexec, nosuid, and nodev (unless
          overridden  by  subsequent  options,  as  in  the  option   line
          user,exec,dev,suid).
Run Code Online (Sandbox Code Playgroud)

您可以通过在exec选项后指定选项来获得所需的行为user

也可以看看