My Linux server can be pinged but cannot be connected
Problem description
You cannot remotely connect to an Alibaba Cloud Simple Application Server running Linux, but you can ping the server.
Causes
Possible causes:
Solutions
Make sure that your local network works properly, and then perform the following troubleshooting steps:
Check whether the server password is correct
If the remote connection fails because you entered an incorrect server password, change the server password. For more information, see Manage the password of a server.
Check whether the SSH service configuration is abnormal
Connect to the server by using the rescue feature. For more information, see Connect to a Linux server by using the rescue feature.
Run the following command to check whether the SSH service is listening normally.
netstat -lntup|grep 22If output similar to the following is returned, the SSH service is listening normally.
If the SSH service is not listening normally, see Test and verify the TCP and UDP ports of ECS instances in Linux to fix the issue.
Check whether the configuration file is abnormal
Check whether the configuration file is abnormal. For example, if certain enabled parameters prevent remote logon, comment out the parameters. For more information, see What do I do if the "Permission denied, please try again" error message appears when I log on to a Linux instance as the root user by using SSH?.
Check whether the firewall disables port 22
Connect to the server by using the rescue feature. For more information, see Connect to a Linux server by using the rescue feature.
Run the following command to check whether the firewall on the Linux server disables port 22 (the SSH service).
firewall-cmd --query-port=22/tcpIf the following output is returned, the firewall disables port 22.
[?cdkj@he171bqz ~]# firewall-cmd --query-port=22/tcp noRun the following command to stop the firewall.
systemctl stop firewalld
For more troubleshooting methods, see FAQ.