Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 user@
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 user@ /local/dir -o ssh_command="ssh"
user@'s password: 
[root@ .ssh]# df -h
Filesystem            Size  Used Avail Use% Mounted on
                     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 user@ /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.

share|improve this question
I tested on CentOS 5 and got the same symptoms and results. – Chris Ostmo Jan 14 '13 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. – Chris Ostmo Jan 14 '13 at 6:27
up vote 0 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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