How to mount a folder on amazon ec2 instance with private key using sshfs

Sanath Ballal picture Sanath Ballal · Mar 6, 2014 · Viewed 15.9k times · Source

I am trying to mount a folder on my amazon ec2 instance to my desktop folder using sshfs.

The problem is that I am not able to figure out how to give the option for private key (awskey.pem).

Normally I ssh using

ssh ec2-user@{amz-ip-address} -i {path to amzkey.pem}

But sshfs has no such options. However I saw a -F option and tried

sshfs ec2-user@{amz-ip-address}:{amz-folder}  {my mount dir} -F {path to amzkey.pem}

This gave me an error

"read: Connection reset by peer"

Please let me know if anyone has tried this before.

Answer

Uri Agassi picture Uri Agassi · Mar 6, 2014

From the documentation:

If you are using non-default key names and are passing it as -i .ssh/my_key, this won't work. You have to use -o IdentityFile=/home/user/.ssh/my_key, with the full path to the key.