0

I created 2 aws ubuntu 12.04 servers

I uploaded the id_rsa and id_rsa.pub files to both servers

I ran the below on both servers

chmod 600 id_rsa*
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa

What did I do wrong?

ssh [email protected]
The authenticity of host 'ec2-54-183-89-212.us-west-1.compute.amazonaws.com (172.31.5.34)' can't be established.
ECDSA key fingerprint is 2a:3a:43:9d:e8:aa:50:2f:f3:83:c4:e2:2e:b2:f2:e7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-54-183-89-212.us-west-1.compute.amazonaws.com,172.31.5.34' (ECDSA) to the list of known hosts.
Permission denied (publickey).
1
  • 1
    Have you added machine1's public key to machine2's authorized_keys file? Uploading the keys to .ssh/id_rsa* does not make a server accept them for incoming connections.
    – fkraiem
    Jul 18, 2014 at 7:29

1 Answer 1

0

ssh-add adds to the keys to SSH agent for authentication in connections opened from the server, not for connections to the server. So you'll have to do:

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Further, the permission on ~/.ssh/id_rsa.pub need not be 600, since it is the public key. It can be 644 without loss of security.

You must log in to answer this question.

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