2

I was following this tutorial to generate and assign a key to one of my servers, but before running ssh-copy-id -i ~/.ssh/mykey user@host I was tring to find my private key and guess what I can't find it. :x

Sorry if this is recurring question but I've check this before but I can't get any answer to my question.


So, I've run ssh-keygen then tried cat ~/.ssh/id_rsa/mykeynamebut there's no key.
Also ls ~/.ssh -a only shows the known_hosts file.

But I can see the public key in my home folder. mykey.pub

I'm kinda new to the ssh authentication process so I would love some help or if the case some link to another question ( I'll delete this question if needed).

Thanks in advance.

9
  • So, I've run ssh-keygen then tried cat ~/.ssh/id_rsa/mykeynamebut there's no key.
    – kpuccino
    Jun 28, 2018 at 13:33
  • I'm not trying to be mean, and I know my English is not perfect. But, did you read my question?
    – kpuccino
    Jun 28, 2018 at 13:37
  • 2
    I did, and I understand how it works. The file name is ~/.ssh/id_rsa by default. If you typed in the name of mykey then you will have both a mykey which should be the private key and mykey.pub being the public in your ~/.ssh folder. If both files are not there, you did not follow the directions properly.
    – Terrance
    Jun 28, 2018 at 13:39
  • 1
    id_rsa is supposed to be a file, not a directory. There can't be a ~/.ssh/id_rsa/mykeyname.
    – muru
    Jun 28, 2018 at 13:40
  • 1
    Mine is just ssh user@host after I have ran the ssh-copy-id user@host command without specifying a new key. Using the -i requires a name and if you have a lot of different ones then you will have to remember them all. Just a thought.
    – Terrance
    Jun 28, 2018 at 14:34

1 Answer 1

5

IF you followed that tutorial exactly i.e. answered mykey at the prompt

Enter file in which to save the key (/home/ylo/.ssh/id_rsa):

then it will be in a file called mykey in your current directory.

If you want it to be in the default location ~/.ssh/id_rsa then simply hit Enter at that prompt to accept the default value.

1
  • Thanks my friend, yup that was my problem. I' ve create on my home dir, but since i've so many trashi didn't notice the private since it has no extension.
    – kpuccino
    Jun 28, 2018 at 13:40

You must log in to answer this question.

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