I used the ssh-keygen utility bundled with High Sierra to create keys, as directed by this page title How to Create SSH Keys with OpenSSH on Linux or macOS at DigitalOcean.com.

Oddly, the prompt to save the new file for keys indicated the .ssh/id_rsa folder. Yet, the new keys were found in my home folder.

Here is my session, replacing a couple things with blah_blah_blah.

I entered a file name of acme. The pair of files named acme & acme.pub were saved to my home folder of /Users/basilbourque, not .ssh.

MacBook-Pro:~ basilbourque$ which ssh-keygen
MacBook-Pro:~ basilbourque$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/basilbourque/.ssh/id_rsa): acme
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in acme.
Your public key has been saved in acme.pub.
The key fingerprint is:
SHA256:blah_blah_blah basilbourque@MacBook-Pro.local
The key's randomart image is:

➥ Any idea why the destination path indicated in the prompt was ignored?

One possible issue: There is no id_rsa folder nested in my .ssh folder, only a known_hosts file is found there.

I ask for two reasons:

  • Mere curiosity.
    • Why would the ssh-keygen utility display a path in the prompt if it is going to ignore that path?
    • Why would the ssh-keygen utility display a path to a non-existent folder?
  • Wondering if this will result in the ssh connection tool failing to find and utilize the keys for logging into a new ssh connection session.

Is there some place I should move these keys so that will be found by the ssh connection tool? (I am new to using ssh.)


You are prompted for a file name, not a folder name (Enter **file** in which to save the key). So if you just reply with a file name the keys will be stored (with that name) in the current directory. You can just move them to .ssh/ manually if necessary. You probably also need to tell ssh to use your keys instead of the default ones (or you rename your keys to the default name).

  • (A) I did enter a file name, acme in the text seen in my Question. Why the is this path /Users/basilbourque/.ssh/id_rsa in the prompt for the file name if the keys will land in the current directory? And why a path to a non-existent folder? (B) I have no idea what you might mean by a default name or default key. That makes no sense to me as a person might be ssh-ing into any number of different servers each with a different key. – Basil Bourque Nov 20 '18 at 7:41
  • @BasilBourque It asks for a file, not a folder. – nohillside Nov 20 '18 at 7:53
  • @BasilBourque Please read up on how ssh works. You create one key pair for your computer and copy the public key to the authorized_keys file on the machines you want to log in to. At least for simple operations there is no need to create several key pairs on the same machine. – nohillside Nov 20 '18 at 7:55
  • Because /Users/[USERNAME]/.ssh/id_rsa is the default name and path for your ID file. Just like saving in many other programs suggests a name and location, ssh_keygen tries to save your ID as file "id_rsa" in folder /Users/[USERNAME]/.ssh – dr.nixon Nov 20 '18 at 20:38
  • If you give it a different name and don't include path, it saves to current directory. You entered "acme", not "/Users/basilbourque/.ssh/acme" – dr.nixon Nov 20 '18 at 20:39

You must log in to answer this question.

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