This is NOT about public key authorization, I know how to copy the public key and ssh that way. This is about the private key.
So I just created 2 VMs, they're connected through vagrant private network. One of them is called server01 the other is called server02.
I created user '01' on 'server01', and user '02' on 'server02'.
ssh-keygen on both of them, so they each have
I copy the contents of 01's
id_rsa (the private key) into a file called
01key in 02's machine.
I then ssh into 01 from 02 with the following command:
ssh -i 01key email@example.com
And it asks me for the password....
Why? Isn't the whole point of connecting with the private key that you DON'T use passwords? I created a Linux server on AWS and it provided me with a private key for that particular instance and I was able to
ssh -I key into it without it asking for the password, so what am I doing wrong?
I checked the permissions on the 01key file, and they're 600.
EDIT: All the answers are irrelevant. I know how to use the public key to connect through ssh, but that's not what I'm looking for.
I created a Linux instance on AWS and created an ssh keypair, then it only gave me the PRIVATE key, which I could use to connect to that AWS instance. That's what I'm talking about.