A missing sshd_config file is one of the most common causes of SSH login failures on Linux simple application servers. This topic shows how to check whether the file exists and recover SSH access when it is missing.
Prerequisites
Before you begin, ensure that you have:
Access to the Alibaba Cloud console
A simple application server that is running
Check for the sshd_config file
Use the rescue feature to connect to the Linux simple application server. For more information, see Connect to a Linux server by using the rescue feature.
Run the following command to check whether the
sshd_configfile exists:ll /etc/ssh/sshd_configIf the file is missing, the output shows an error similar to the following screenshot. Continue to the next step to recover it.

Choose one of the following recovery methods.
Option 1: Copy sshd_config from another server (recommended)
Use this option if you have another simple application server with a working sshd_config file.
Run the following command to copy
sshd_configfrom the working server to this one. Replace<Public IP address of the simple application server that contains the sshd_config configuration file>with the actual public IP address:scp root@<Public IP address of the simple application server that contains the sshd_config configuration file>:/etc/ssh/sshd_config /etc/sshFor example, if the source server's public IP address is
120.27.XX.XX:scp root@120.27.XX.XX:/etc/ssh/sshd_config /etc/sshRestart the sshd service to apply the configuration:
systemctl restart sshd
Option 2: Roll back the system disk based on a snapshot
Use this option if you created a snapshot before the issue occurred and do not have another server to copy sshd_config from.
Follow the steps in the "Roll back a disk based on a snapshot" section in Manage snapshots.
Verify connectivity
After completing the recovery steps, verify that SSH access is restored. For more information, see Connect to a Linux server.