英文:
AWS EC2 Connection (SSH) says - Connection refused
问题
I was just connected to the instance over ssh and Change permission on home directory to 755 using "sudo chmod -R 755 .". After that, I can't execute any single commands through SSH shell. So I have disconnect and find my ec2 public IP has been changed. Now i am trying to connect with ec2 instance using .pem file, it says connection refused and port 22 is showing as closed.
Note: I have tried to reconfigure security group inbound rule for port 22 and stop,start my instance but none of these worked.
英文:
I was just connected to the instance over ssh and Change permission on home directory to 755 using "sudo chmod -R 755 ./". After that, I can't execute any single commands through SSH shell. So I have disconnect and find my ec2 public IP has been changed. Now i am trying to connect with ec2 instance using .pem file, it says connection refused and port 22 is showing as closed.
Note: I have tried to reconfigure security group inbound rule for port 22 and stop,start my instance but none of these worked.
答案1
得分: 1
这可能意味着您的EC2实例上的sshd已经停止。
第一件事:SSH对权限非常敏感;请参考ssh-and-home-directory-permissions
第二件事:公共IP的更改意味着实例已经停止/启动,而不仅仅是断开连接;EC2不会在未经停止/启动的情况下失去其公共IP。
因此,您可能在更改权限时破坏了SSH访问权限;而且SSH可能没有启用,所以当您重新启动实例时,它没有启动,导致连接被拒绝错误。
您可以尝试通过控制台连接并进行故障排除;或者遵循此问题的解决方案:https://stackoverflow.com/questions/12447438/ec2-ssh-port-22-connection-refused-even-though-previously-worked?rq=2
英文:
That probably means sshd is down on your ec2 instance.
1st thing: SSH is very sensitive to permissions; please refer to ssh-and-home-directory-permissions
2nd thing: change of public IP means the instance was stopped/started, not just disconnected; an EC2 does not lose its public IP without a stop/start.
So probably you broke your ssh access when changed permissions; and ssh might not have been enabled, so when you reboot the box, it was not started leading to connection refused error.
You can try to connect through the console and troubleshoot; or follow this question https://stackoverflow.com/questions/12447438/ec2-ssh-port-22-connection-refused-even-though-previously-worked?rq=2
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论