How can you execute files mounted via sshfs?

2

1

This does not work:

$ touch testfile
$ chmod 777 testfile
$ ls -l testfile
-rwxrwxrwx 1 quinn dialout 0 Apr 18 10:15 testfile
$ ./testfile
-bash: ./testfile: Permission denied
$ sudo ./testfile
sudo: unable to execute ./testfile: Permission denied

I am mounting via this line in my fstab:

sshfs#127.0.0.1:/remote-dir /data/local-dir fuse port=2222,user,uid=1000,allow_other 0 0

note: I am connecting to localhost over port 2222 because I am using a tunnel.

quinn

Posted 2014-04-18T11:31:02.710

Reputation: 345

I updated the example to address your question. – quinn – 2014-04-18T15:17:10.473

Answers

6

You need to add the exec option to your fstab line.

From the ArchWiki page for fstab:

exec - Allow execution of binaries on the filesystem.
...
user - Allow any user to mount the filesystem.
       This automatically implies noexec, nosuid, nodev, unless overridden.

So you have user, but user implies noexec, so you need to add exec to negate that.

Hypershadsy

Posted 2014-04-18T11:31:02.710

Reputation: 173

My line is myuser@mydomain:/home/myuser /home/myotheruser/mymountpoint fuse.sshfs users,_netdev,reconnect,uid=myotheruser,gid=myotheruser,idmap=user,allow_other,exec 0 0 where myuser is a remote host user and myotheruser is local client user. – Hypershadsy – 2014-09-03T00:19:37.423