How to ssh into EC2 instance without PEM key?

I have created an amazon Ec2 instance and I am trying to ssh into the server from my local machine. I can do so with the PEM key but even after adding my local machine's public key to the authorized keys, I cannot login without it. It just tells me "Permission denied (publickey)." Here is the trace. debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/joelscalera/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey debug1: Trying private key: /var/root/.ssh/id_rsa debug3: no such identity: /var/root/.ssh/id_rsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_dsa debug3: no such identity: /var/root/.ssh/id_dsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_ecdsa debug3: no such identity: /var/root/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /var/root/.ssh/id_ed25519 debug3: no such identity: /var/root/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey).


You need ssh-agent to supply your PEM file during ssh.

First, start the ssh-agent:

eval `ssh-agent -s`

Then add you PEM key to agent

ssh-add <pem-key>

Now you can ssh without supplying PEM.


您可以将EC2 pem密钥添加到ssh

ssh-add ~/.ssh/key_pair.pem
链接地址: http://www.djcxy.com/p/38984.html

上一篇: 亚马逊产品API与R

下一篇: 如何在没有PEM密钥的情况下ssh进入EC2实例?