All Products
Search
Document Center

:Failed to connect to a Linux instance by using SSH

Last Updated:Dec 29, 2020

Problem description

You can use VNC to connect to a Linux instance, but you cannot use SSH to connect to the instance.

Cause

In the /etc/sshd_config file, the value of the AllowUsers parameter is empty, causing SSH to fail to connect to Linux instances remotely.

Solution

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
  1. Log on to a Linux instance. For more information about how to log on to a Linux instance, seeconnect to a Linux instance by using a management terminal.
  2. Edit /etc/sshd_config, set the value of the AllowUsers parameter to root, save the settings, and exit.
    Note: back up files before modifying them.
  3. Then restart the SSH service and make sure that you can use SSH to remotely log on to the Linux instance.

Application scope

  • Elastic Compute Service