Troubleshoot SSH connections to Linux instances with Workbench

更新时间:
复制 MD 格式

Connection timeout when connecting with Workbench

Symptoms

When you use Workbench to remotely connect to a Linux instance, the connection fails with the error message "Logon to host: i-m5e****73a (47.*.*.157:3389) failed, Reason: connection timeout!" When you attempt to connect to the instance by using Workbench, the Establish remote connection failed dialog box appears, indicating that the logon failed due to a connection timeout. A warning message states that to access the public IP address, you must add the Workbench server CIDR blocks to the security group allowlist of the instance: 47.96.60.0/24 and 118.31.243.0/24. At the bottom of the dialog box, three buttons are available: Connect by using VNC, Close Terminal, and Reconnect.

Causes

This issue is typically caused by one of the following:

  • A rule in the instance's security group prevents Workbench from connecting.

  • The SSH process does not use the default port 22.

  • The firewall settings in the Linux instance disallow connections from Workbench.

Solution

Follow these steps to troubleshoot the issue:

  1. Check the SSH port configured on the instance. For more information, see Check the port and security group.

    • If the port is not 22:

      Change the SSH port and try connecting with Workbench again.

    • If the port is 22:

      Proceed to the next step.

  2. Check the instance's security group settings to verify that the SSH port is open. For more information, see Query security group rules.

    Note
    • In this example, the default SSH port 22 is used. If you have changed the default SSH port, use your custom port number.

    • If the authorization object is not 0.0.0.0/0, you must also add the IP addresses that you use to access the instance, such as 47.96.60.0/24 and 118.31.243.0/24.

    Rule direction

    Policy

    Priority

    Port range

    Authorization object

    inbound

    Allow

    1

    destination: 22/22

    • source: 47.96.60.0/24 and 118.31.243.0/24

    • source: 0.0.0.0/0

    • If the port is not open:

      Add a security group rule to allow access from Workbench, as shown in the table above. For more information, see Use Workbench to connect to a Linux instance.

    • If the port is open:

      Proceed to the next step.

  3. Check if the instance's firewall is enabled and blocking SSH connections from Workbench. Perform the following steps:

    1. Log on to the Linux instance by using Alibaba Cloud VNC. For more information, see Connect to an instance by using VNC.

    2. Check the firewall status. For more information, see Manage the system firewall of a Linux instance.

      • If the firewall is enabled, disable it, and then try connecting with Workbench again.

      • If the firewall is not enabled, continue with further troubleshooting.

    3. If you still cannot connect with Workbench, use VNC instead.

Connection refused when connecting with Workbench

Symptoms

When you connect to a Linux instance by using Workbench, the connection fails with the error message "Failed to log on to the instance: DefaultConnectFuture[root@/xxx.xxx.xx.xxx:22]: Failed (AnnotatedConnectException) to execute: Connection refused: /xxx.xxx.xx.xxx:22".

Cause

The remote service for terminal connections (SSH) is not enabled on the instance.

Solution

Check the following items:

  • Check whether the Linux instance has the required remote service enabled for terminal connections (SSH). If not, enable the corresponding remote service. For more information, see Methods to test TCP/UDP ports on a Linux instance.

  • Check whether the required connection port is open on the Linux instance. If not, open the port. For terminal connections (SSH), port 22 is typically used.

Incorrect username or password when connecting with Workbench

Symptoms

When you try to connect to a Linux instance with Workbench, you receive the error message "Failed to log on to the instance. Reason: Incorrect username or password".

Causes

Common causes include:

  • You entered or pasted an incorrect username or password.

  • The SSH configuration of the Linux instance does not allow the root user to log on.

Solution

Follow these steps to troubleshoot the issue:

  1. If the username or password is incorrect, reset the instance password. For more information, see Reset the logon password of an instance.

  2. If the root username and password are correct, the instance's SSH configuration may prevent the root user from logging in. To resolve this, do one of the following: