Created Wed Jun, 03 2020 at 06:14PM

While working on a vagrant Ubuntu VM I tried to mount the remote fs via: sshfs vagrant@x.x.x.x ~/mnt/foo command and got the error remote host has disconnected. I thought it was probably that I had setup my ~/.ssh/config to automatically attempt to use my own private key to authenticate. However, specifying the keyfile manually wasn't working either.

To help diagnose my issue I found adding debug to your options helps.

sshfs -o debug,ssh_command='ssh -i .vagrant/machines/default/virtualbox/private_key' vagrant@192.168.56.42:/opt/remote/fs ~/mnt/foo

After adding the debug option I quickly saw the error.

FUSE library version: A.B.C
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
Warning: Identity file .vagrant/machines/default/virtualbox/private_key not accessible: No such file or directory.
Warning: Permanently added '192.168.56.42' (ECDSA) to the list of known hosts.
vagrant@192.168.56.42: Permission denied (publickey).
remote host has disconnected

I was in the directory where .vagrant/machines/default/virtualbox/private_key exists, however I still needed an absolute path for some reason, which fixed it.