0

AWS および SSH セッションに関して多くの質問があることは承知しており、それらを利用しようとしましたが、すべて失敗しました。

インスタンスを実行していますが、EC2 管理コンソールによって指定された ssh 文字列は次のとおりです。

ssh -i -v jason.pem ubuntu@ec2-54-227-167-156.compute-1.amazonaws.com 

出力を生成する

OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-54-227-167-156.compute-1.amazonaws.com [54.227.167.156] port 22.
debug1: Connection established.
debug1: identity file jason.pem type -1
debug1: identity file jason.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.9p1 Debian-5ubuntu1.1
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ea:b6:50:fe:49:49:90:76:03:91:21:6d:73:0e:04:d2
debug1: Host 'ec2-54-227-167-156.compute-1.amazonaws.com' is known and matches the   ECDSA host key.
debug1: Found key in /home/jason/.ssh/known_hosts:27
debug1: ssh_ecdsa_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: Trying private key: jason.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).

私は次のことをしました:

  • 新しい鍵ペアを作成し、ダウンロードjason.pemして 0400 chmod 権限に設定
  • ChallengeResponseAuthentication yes/etc/ssh/ssh_config に追加

正確には何が起こっているのjason.pemですか? ファイルが受け入れられないのはなぜですか?

4

1 に答える 1

1

インスタンスの公開鍵が秘密鍵ペアと一致しません。そのインスタンスの構成が重要であり、それを保持したい場合 (単に新しいインスタンスを作成するのではなく、インスタンスをシャットダウンしたという事実に基づいてこれを言います):

  1. 新しい鍵ペアを作成する
  2. アクセスするインスタンスの AMI を作成する
  3. 新しいキーペアを使用してその AMI から新しいインスタンスを作成します
  4. 新しくダウンロードした鍵ペアを使用して、再度 ssh を試みます

キーペアのアクセス許可は 400 で十分です。

于 2013-07-22T16:32:32.363 に答える