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

我创建了一个亚马逊Ec2实例,我试图从本地机器ssh进入服务器。 我可以使用PEM密钥,但即使将本地计算机的公钥添加到授权密钥后,我也无法登录。 它只是告诉我“权限被拒绝(publickey)”。 这是跟踪。 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).


您需要ssh-agent在ssh期间提供您的PEM文件。

首先,启动ssh-agent:

eval `ssh-agent -s`

然后将您的PEM密钥添加到代理

ssh-add <pem-key>

现在你可以在不提供PEM的情况下ssh。


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

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

上一篇: How to ssh into EC2 instance without PEM key?

下一篇: Through ssh connecting to ec2 instance error?