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달 전172회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠