5

In Finder, using the Connect to Server option, I am able to specify the server I wish to connect to using ssh://user@server form (hostname or IP). However, the server I'm connecting to requires public key authentication, thus Finder,when I press the connect button, responds in a new window:

Permission denied (publickey)
[Process completed]

How do I configure Finder to be able to locate my private key in ~/.ssh?

macOS Sierra 10.12.3

5

Finder in macOS Sierra appears to only add the id_rsa key by default. If you want to add other keys you either have to add them manually or alter the configuration.

on my machine a simple ssh-add ~/.ssh/test.key worked.

According to this guide you can also store the keys in your keychain:

In ~/.ssh create config file with the following content:

Host * (asterisk for all hosts or add specific host)
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile <key> (e.g. ~/.ssh/userKey)

You can read more about this on the Apple Developer Site

  • Whilst this worked, it did not open the server in Finder, which was my objective as I'm able to connect to the server from a terminal using SSH. – gone Mar 25 '17 at 2:49
  • 1
    @gone to my knowledge this is not possible since Finder only Supports FTP. If you want to actually mount SFTP in Finder, try SSHFS or a GUI variant like macfusionapp.org – rwenz3l Mar 26 '17 at 12:39
2

You have to add your public key (e.g. ~/.ssh/id_rsa.pub) to the authorized_keys file on the server. If you have no key/public key create one with:

ssh-keygen -t rsa -b 4096 -C "user@host" #-C "user@host" is an optional comment

If you have no access to the server you have to provide the public key to an admin and ask him to add it to the authorized_keys file on the server.


Creating a config file as proposed in rwenz3l's answer is not required when you didn't enter a passphrase for the rsa key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .