All Products
Search
Document Center

:Check Linux instances for the required files or directories required by the SSH service

Last Updated:Dec 28, 2020

Overview

If key files or directories are missing, you may fail to log on to a Linux instance. This article describes how to check whether the sshd_config configuration file exists in an ECS instance when you cannot connect to the instance remotely.

Detail

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. Detach the system disk of the abnormal ECS instance and attach the disk as a data disk to a normal ECS instance. For more information, seehow to log on to an abnormal system disk by attaching a data disk to an ECS instance. For more information, see Step 1 to step 4.
  2. Access the mounted directory of a normal instance, switch to the root user, and run the following command to check the configuration file sshd_config.
    ll /etc/ssh/sshd_config
  3. If the sshd_config configuration file does not exist, run the cp command to copy the /etc/ssh/sshd_config file of the system disk of a normal ECS instance to the /etc/ssh Directory of the Mount directory.
  4. See step 5 "how to log on to an abnormal system disk by using an ECS instance as a data disk to restore the system disk of an abnormal ECS instance."
  5. Remotely log on to the repaired ECS instance and make sure that it is working properly again.

Application scope

  • Elastic Compute Service