Connection Issue After Stopping and Restarting EC2 Instance

0

Hi all

I have been using the following ssh command to login to my EC2 instance without any issues from Windows OS. ssh - "mykey.pem" ubuntu@ip-address.com

Then, I accidentally stopped the EC2 instance. And restarted it. My EC2 instance was assigned with a new IP address.

When I try to login via ssh - "mykey.pem" ubuntu@NEW-ip-address.com

The system prompts: This service allows sftp connections only.

I have assigned security group that allows TCP and UDP (all ports) - basically, allow all connections.

Please advise. Thanks.

Regards Ken

Ken
已提问 7 个月前171 查看次数
2 回答
0

Hello.

Did you change the "/etc/ssh/sshd_config" settings before stopping EC2?
If you have changed it, I think the settings are incorrect and SFTP connection is enabled.
If SSM Agent is installed on EC2, you may want to check the settings of "/etc/ssh/sshd_config" after connecting to EC2 using Session Manager.
To connect to EC2 with Session Manager, you need to set up an IAM role.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-instance-profile.html

profile picture
专家
已回答 7 个月前
0

Hi,

I did not change the "/etc/ssh/sshd_config". I just accidentally used the "sudo systemctl poweroff -i" (instead of restart) command and the instance was stopped.

After restarting the instance via AWS console, I couldn't use "ssh" anymore from Windows OS. Message: This service allows sftp connections only. Connection closed.

Note: I have other EC2 instances - using the same security group and I could login via ssh. Same "ssh" command and "key" and username .. just different IP addresses.

Regards Ken

Ken
已回答 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则