AWS EC2 Connection closed by when trying ssh into instance

前端 未结 8 1092
猫巷女王i
猫巷女王i 2020-12-14 05:26

Recently I set up a new EC2 instance. The next day I was not able to connect to my instance via ssh. I could connect and disconnect the day before, I am sure I did nothing.

8条回答
  •  别那么骄傲
    2020-12-14 06:12

    I had this problem and it turned out the PEM file was incorrect. You can check following the instructions in Amazon EC2 Key Pairs - Verifying Your Key Pair's Fingerprint:

    If you created your key pair using AWS, you can use the OpenSSL tools to generate a fingerprint from the private key file:

    $ openssl pkcs8 -in path_to_private_key -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
    

    If you created your key pair using a third-party tool and uploaded the public key to AWS, you can use the OpenSSL tools to generate a fingerprint from the private key file on your local machine:

    $ openssl rsa -in path_to_private_key -pubout -outform DER | openssl md5 -c
    

    The output should match the fingerprint that's displayed in the console.

提交回复
热议问题