sshfs - mounting with private key

15.05.2014 by Dirk Olmes

To analyze data on a customer’s server, I often hack together small Groovy scripts. I type tiny scripts right in the editor on the remote side but sometimes it’s tedious to type over a slowish ssh connection.

sshfs seems to come in quite handy in this case. However everytime I tried before I was unable to make sshfs work with ssh keys (password auth is disabled on the customer machines).

Now I stumbled over the Arch Linux‘ Wiki which had the right bit of info hidden inside of their sshfs documentation page.

Long story short: To mount via sshfs using an existing ssh key, use

sshfs -o IdentityFile=/path/to/the/ssh/private/key host:/dir /mountpoint

This approach even works with an ssh agent. Make sure that you get all prompts out of the way (i.e. asking for the key password etc) before mounting.


Comments

There are no comments yet.

Leave a comment
Your name:
Comment: