- Newest
- Most votes
- Most comments
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
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
Relevant content
- Accepted Answerasked 7 months ago
- asked 2 years ago
- Accepted Answerasked 16 days ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Thank you for your reply. Is it possible to connect to EC2 using Session Manager? https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-instance-profile.html
You may be able to identify the cause by connecting with Session Manager and checking SSH logs such as "/var/log/secure".
Please also check the system log for any errors. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html#instance-console-console-output