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
feita há 7 meses171 visualizações
2 Respostas
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
ESPECIALISTA
respondido há 7 meses
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
respondido há 7 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas