12

新しいEBSボリュームを追加した後、「sudo shutdown -r now」でマシンを再起動した後、ec2インスタンスをssh経由で接続していました

その後、次のコマンドを使用してアクセスしようとしました。

ssh -v  -i primary_key.pem ubuntu@ec2-23-22-245-160.compute-1.amazonaws.com

これは以下のように再調整されます:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
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).

何が問題なのですか?

4

2 に答える 2

15

これは、Amazon EC2 の通常の動作です。インスタンスを再起動すると、関連付けられているパブリック IP (あなたのものec2-23-22-245-160.compute-1.amazonaws.com) が変更されます。

インスタンスを ssh 経由で接続するには 2 つの方法があります

  1. Amazon AWS コンソールにログインし、実行中のインスタンスを確認してから、パブリック DNS をコピーして、ssh で接続を試みます。(sskキーは同じ)

  2. 再起動/終了のたびにインスタンスのパブリック IP を変更したくない場合は、Elastic IP を使用します。(インスタンスではなく) アカウントに関連付けられた Elastic Ip。必要なインスタンスに Elastic Ip を割り当てることができます。

sshで接続できますssh -v -i primary_key.pem ubuntu@<ElasticIp>

于 2013-04-06T06:30:29.497 に答える
0

同様の問題がありました。これが私がやったことです..!

ssh -i < .pem file> -vvv <server IP>

上記のコマンドはデバッグ ログを表示し、ECDSA キーが受け入れられた後にログインします。

于 2018-02-18T04:01:25.960 に答える