I am trying to mount a remote file system through sshfs using public key authentication. I am getting this error: execvp: No such file or directory

I can confirm that public key authentication is working with ssh:

ssh -i /home/me/.ssh/myKey [email protected]
Last login: Sun Jan 13 21:25:13 2013 from

I can confirm that sshfs is properly mounting the remote directory with password authentication:

sshfs [email protected]:/remote/dir /local/dir -o ssh_command="ssh"
[email protected]'s password: 
[[email protected] .ssh]# df -h
Filesystem            Size  Used Avail Use% Mounted on
sshfs#[email protected]:/remote/dir
                     1000G     0 1000G   0% /local/dir

(I know that the '-o' above isn't necessary. I used it to show that the failure to find ssh isn't the reason this is failing) But when I try to connect the public key options to the sshfs mount, like so:

sshfs [email protected]:/remote/dir /local/dir -o ssh_command="ssh -i /home/me/.ssh/myKey",sshfs_debug

I get this: execvp: No such file or directory on the console and the directory isn't mounted.

I confirmed that "No such file or directory" isn't that it can't find ssh (and I used /usr/bin/ssh just to be certain) and I confirmed that the path to the key is correct:

ls -al /home/me/.ssh/myKey
-rw-------  1 nobody root 887 Jan 13 20:36 /home/me/.ssh/myKey

The remote host does not have any log file entries on the failed attempts.

I am using the command in the documented manner as far as I can tell, so it should be working, right? The system where this failure occurs is running RHEL5.

Can anyone shed some light on the issue or point me in the right direction? I'm about out of troubleshooting ideas.

The IPs and usernames have been changed to protect the innocent. Sorry if I made typos following copy and paste. I'll fix 'em if any are found.

  • I tested on CentOS 5 and got the same symptoms and results. Jan 14, 2013 at 3:53
  • I found a work-around, but serverfault won't let me post it yet because my reputation doesn't allow for that. I'll post the work-around as soon as I'm cleared to do so. Jan 14, 2013 at 6:27

1 Answer 1


Since I had the same problem on CentOS, I was running with the assumption that ssh_command doesn't work as advertised (also meaning that it doesn't work the same as most other things that can hook into SSH -- rsync, for example). I began looking for ways that I could configure SSH to set the options I need without requiring for me to feed input from the command line to sshfs, and I found the combination that works.

I added to /etc/ssh/ssh_config the following lines:

Host remotehost
User user
IdentityFile /home/me/.ssh/myKey

After doing that, I no longer needed to feed any command line options to SSH through sshfs and ended up with this command:

sshfs user@remotehost:/remote/dir /local/dir

It should be noted that remotehost in the sshfs command is the exact value that was defined for the Host key in ssh_config.

If someone knows of a way to perform this task using command line options, I am still interested as I don't think that it's right that it should require a system-wide configuration change to make this work as the documentation claims. Until then, I at least have a work-around. I hope this helps someone else avoid the hours I spent on it.

FWIW, post 4 on this thread was the source of my inspiration. Post 5 looks promising as a way to be able to avoid altering the system-wide configuration, but that lead to the error execvp: Permission denied

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .