Where is my private key?

13,708

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.

Share:
13,708

Related videos on Youtube

kpuccino
Author by

kpuccino

Profile not found

Updated on September 18, 2022

Comments

  • kpuccino
    kpuccino over 1 year

    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.

    • kpuccino
      kpuccino almost 6 years
      So, I've run ssh-keygen then tried cat ~/.ssh/id_rsa/mykeynamebut there's no key.
    • kpuccino
      kpuccino almost 6 years
      I'm not trying to be mean, and I know my English is not perfect. But, did you read my question?
    • Terrance
      Terrance almost 6 years
      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.
    • muru
      muru almost 6 years
      id_rsa is supposed to be a file, not a directory. There can't be a ~/.ssh/id_rsa/mykeyname.
    • kpuccino
      kpuccino almost 6 years
      Okidoki, sorry for the "anger". Some people ask things for yesterday to unexperience people. Thanks for the help.
    • Terrance
      Terrance almost 6 years
      Might I add a little note here. Those instructions can make it more difficult to use the private / public keys by making you have to type in the name of the key you have used every time you want to connect to the other host without a password. If you go with only the default settings, ssh will default to the key of id_rsa and there is no need to specify it every time you want to connect.
    • kpuccino
      kpuccino almost 6 years
      So how do you connect then? ssh -i user@host it's enough? It will fetch the ~/.ssh/id_rsa key? I'm adding the keys because I need create some scripts to migrate data.
    • Terrance
      Terrance almost 6 years
      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.
    • kpuccino
      kpuccino almost 6 years
      Many thanks, I'll need to dive in ssh docs to get more useful info.
  • kpuccino
    kpuccino almost 6 years
    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.