MacOS – Using public key with OSXFUSE

filesystemmacosssh

I have been allotted a system-generated password (which is impossible to remember) that I cannot change and every time I mount a folder from the remote machine, I have to enter the password for that account.

I have set-up a public key based log-in which works fine when I use ssh. That is, I do not have to enter the password when I am using ssh.

However, when I use OSXFUSE to mount a folder, I am asked for the password every time. How do I make OSXFUSE to use the public key for mounting the folder?

Command that I use to mount the folder:

sudo sshfs -o allow_other,defer_permissions root@xxx.xxx.xxx.xxx:/ /mnt/droplet

Best Answer

After trying some suggestions from https://github.com/osxfuse/osxfuse/issues/341 (An open issue for OSXFUSE), the following command worked for me -

ssh-add -K ~/.ssh/id_rsa

Use of option -K:

 -K      When adding identities, each passphrase will also be stored in the user's keychain.  When
         removing identities with -d, each passphrase will be removed from it.