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
asked 6 months ago158 views
2 Answers
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
EXPERT
answered 6 months ago
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
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions