When you connect to a Linux Elastic Compute Service (ECS) instance over SSH, make sure that the SSH service is started on the instance. If the SSH service is not started on the instance, you cannot connect to the instance over SSH. This topic describes how to view the status of the SSH service and start the service.
Problem description
You cannot connect to a Linux ECS instance over SSH. You connect to the instance by using Virtual Network Computing (VNC) and run the systemctl status sshd.service
command to check the status of the SSH service (sshd.service
). If inactive (dead) is displayed in the command output, the SSH service is not started. As a result, you cannot connect to the instance over SSH.
Cause
The SSH service may not be started due to various reasons. For example, the sshd process is not configured to automatically start on system startup, the owner or group to which a critical sshd directory belongs is incorrectly configured, the SSH configuration file is abnormal, the PATH environment variable is incorrectly configured, or the required port is occupied.
Solution
Connect to the ECS instance by using VNC.
For more information, see Connect to an instance by using VNC.
Run the following command to check the status of the SSH service:
systemctl status sshd.service
The following command output indicates that the
sshd.service
process is not started.Run the following commands to start the SSH service and configure the service to automatically start on system startup:
sudo systemctl start sshd.service sudo systemctl enable sshd.service
If an error message appears when you start the SSH service, you can resolve the issue based on the error message. For information about how to resolve the issue that the SSH service cannot be started, see the following topics: