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
gefragt vor 7 Monaten177 Aufrufe
2 Antworten
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
EXPERTE
beantwortet vor 7 Monaten
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
beantwortet vor 7 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen