权限被拒绝(publickey)当试图SSH到一台EC2机器(包括-v详细信息)

我不能ssh进入我的机器 – ssh进程似乎没有尝试正确的键(我可能是错的)。 顺便说一下,这是在重新启动后。

通常使用的密钥对是:

/Users/mingyeow/.ssh/id_rsa-gsg-keypair 

在重新启动的机器上失败

 debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /Users/mingyeow/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/mingyeow/.ssh/identity debug1: Trying private key: /Users/mingyeow/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). 

成功在另一台EC2帐户上连接另一台计算机

 debug1: Next authentication method: publickey debug1: Offering public key: /Users/mingyeow/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Offering public key: /Users/mingyeow/.ssh/id_rsa-gsg-keypair debug1: Server accepts key: pkalg ssh-rsa debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Requesting [email protected] debug1: Entering interactive session. 

试试:

 ssh -i ~/.ssh/id_rsa-gsg-keypair [email protected] 

如果这样做,那么在~/.ssh/config

 Host *amazonaws.com IdentityFile ~/.ssh/id_rsa-gsg-keypair