2

I'm trying to create an SSH key to eventually use to connect to a cloud based VM.

(base) Mac:~ user$ ssh-keygen -t rsa -b 2048

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa): test123

Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

Your identification has been saved in test123.
Your public key has been saved in test123.pub.

The key fingerprint is:
SHA256:123123123123123 user@user.local
The key's randomart image is:
+---[RSA 2048]----+
|     REDACTED    |
+----[SHA256]-----+

Now according to tutorials the key should be in

/Users/<my_account>/.ssh/id_rsa.pub

There doesn't seem to be anything in /.ssh other than a file called known_hosts. Where abouts am I going wrong?

Ari
  • 143
  • 1
  • 1
  • 7
  • This question is not really on topic here, this is a user question and more specifically a MacOS question, there are separate sites for those. As for the question, the key probably went into the KeyChain, see here for example: https://superuser.com/questions/447959/where-are-my-ssh-keys-used-for-authentication-being-stored-on-mac-os-x-if-not-in – ojs Oct 20 '19 at 11:06

3 Answers3

1

I think the confusion here was the input phrase: Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa):

I also assumed the path would be /Users/<my_account>/.ssh , which was my mistake... So upon arriving here, I realised it expected a full filepath and not a file(name)...

In case of the OP the command will not have been run when being in the path /Users/<my_account>/.ssh

So either:

  • run command cd ~/.ssh prior to running the ssh-keygen command
  • enter the full filepath when prompted:

Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa): /Users/<my_account>/.ssh/test123

9duust
  • 11
  • 1
1

Okay it seems when I was giving it a file name it was being saved elsewhere or not saved at all.

Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa): test123

So instead of doing that I left it blank, and now the ida_rsa.pub file has appeared.

Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa):

cd in ~/.ssh, then ls

id_rsa      id_rsa.pub    known_hosts
Ari
  • 143
  • 1
  • 1
  • 7
  • 2
    giving it a name makes it save in your root dir... just ```cp ~/test123 ~/.ssh/``` and ```cp ~/test123.pub ~/.ssh/``` and carry on – karuoro May 15 '20 at 14:04
0

You can give any filename you want. What you have mistaken is you are looking inside .ssh directory. if you create the ssh key in similar way that you stated with the filename test123 you will find both test123.pub (public key) and test123 (private key) in the path c:/Users/<my_account>/