我通过SSH连接我的EC2实例,添加新的EBS卷后,通过'sudo shutdown -r now'重新启动机器,然后尝试使用follwing命令访问:
ssh -v -i primary_key.pem [email protected]
这是重新调整如下:
debug1: Reading configuration data /Users/caveman/.ssh/config debug1: Reading configuration data /etc/ssh_config debug1: Applying options for * debug1: Connecting to ec2-23-22-245-160.compute-1.amazonaws.com [23.22.245.160] port 22. debug1: Connection established. debug1: identity file primary_key.pem type -1 debug1: identity file primary_key.pem-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1 debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.6 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'ec2-23-22-245-160.compute-1.amazonaws.com' is known and matches the RSA host key. debug1: Found key in /Users/caveman/.ssh/known_hosts:31 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: primary_key.pem debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey).
什么是错的?我错过了什么?
该线
debug1: Authentications that can continue: publickey
表示您禁用了密码validation。 您只能使用公钥进行身份validation(同时拥有相应的私钥)。
连续两行
debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey
表示您正在使用可以正常读取的RSA私钥,但是其公共对象无法通过服务器进行身份validation。
一些选项可以尝试:
ssh-copy-id )时使用了自己的用户名。 ~ubuntu/.ssh目录下的权限(和所有权!)。 PasswordAuthentication ,则可能表明密码已被重置为空或用户帐户被禁用( usermod -L )以进行login或过期。 尝试使用其他用户login(可能是root用户帐户)。 PasswordAuthentication ,但在此之后没有重新启动它,那么更改可能只会在重新启动后变为活动状态。 请参阅下面的选项以了解如何解决此问题。