Where is my private key?
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.
Related videos on Youtube
Comments
-
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. :xSorry 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 triedcat ~/.ssh/id_rsa/mykeyname
but there's no key.
Alsols ~/.ssh -a
only shows theknown_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 almost 6 years
So, I've run ssh-keygen then tried cat ~/.ssh/id_rsa/mykeynamebut there's no key.
-
kpuccino almost 6 yearsI'm not trying to be mean, and I know my English is not perfect. But, did you read my question?
-
Terrance almost 6 yearsI did, and I understand how it works. The file name is
~/.ssh/id_rsa
by default. If you typed in the name ofmykey
then you will have both amykey
which should be the private key andmykey.pub
being the public in your~/.ssh
folder. If both files are not there, you did not follow the directions properly. -
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 almost 6 yearsOkidoki, sorry for the "anger". Some people ask things for yesterday to unexperience people. Thanks for the help.
-
Terrance almost 6 yearsMight 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 almost 6 yearsSo 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 almost 6 yearsMine is just
ssh user@host
after I have ran thessh-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 almost 6 yearsMany thanks, I'll need to dive in ssh docs to get more useful info.
-
-
kpuccino almost 6 yearsThanks my friend, yup that was my problem. I' ve create on my home dir, but since i've so many
trash
i didn't notice the private since it has no extension.