8

I'm using sshfs in my fstab to mount a filesystem in 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

It mounts fine, but if I try to execute anything in the path I get:

./some-executable: Permission denied.

The file has execute permissions (and works fine if I am actually ssh'd into the system).

If I use the fstab but include the -oexec option again:

mount /mnt/local-mnt -oexec

Then it works. Why is the fstab 'exec' being ignored?

15

The exec option is not being ignored - it's being overwritten by an implicit noexec associated with the subsequent user option. This behavior is alluded to in 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).

You can get the desired behavior by specifying the exec option after the user option.

See also

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.