简体   繁体   中英

SSH connection on ec2

I'm trying to connect to an AWS ec2 instance but I keep being refused. I'm using the same computer, the same wifi but suddenly when I connect to one of my ec2 instance, it fails.

when I connect, it says..

ssh -i successintoeflcom.pem ec2-user@52.68.152.179
ssh: connect to host 52.68.152.179 port 22: Connection refused

ssh -v successintoeflcom.pem ec2-user@52.68.152.179
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 26: Applying options for *
ssh: Could not resolve hostname successintoeflcom.pem: nodename nor servname provided, or not known

I looked at /etc/ssh_config line 26, and found

Host *
   SendEnv LANG LC_*

something got to be wrong, but I haven't found a way to make it right.

I also tried deleting the ec2 instance and make new one with new ssh key and new EIP but it did not work. honestly, I'm new to ssh settings. Any help would be appreciated.

PS For some reason, I was able to connect to other ec2 instance that is on other aws account, which I use for work.

  • Check the Security groups inbound settings, make sure ssh protocol enabled with source as anywhere. Because your System IP address might change.

  • Check with .pem file permission. It should be set with chmod 600.

Start with checking the VPC configuration: ensure the internet gateway is associated properly with the subnet; ensure the SSH port (22) is opened in both the security group and the network ACL. You can follow the guide and the troubleshooting described in the blog-post configure VPC and create SSH connection to a Linux-based EC2 . It touches the traffic rules configuration and explains how to define the SSH keys properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM