If a Linux simple application server does not contain the critical files or directories that are required for SSH access, you may fail to log on to the Linux server. This topic describes how to check whether a simple application server contains the sshd_config
configuration file if you cannot connect to the server.
Procedure
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 simple application server contains the
sshd_config
configuration file:ll /etc/ssh/sshd_config
If the output is similar to the following message, the simple application server does not contain the
sshd_config
configuration file. In this case, you can use one of the following solutions based on your business scenario.Run the scp command to copy a sshd_config configuration file
Run the following command to copy a
sshd_config
configuration file from another simple application server to the simple application server that does not contain the configuration file:scp root@<Public IP address of the simple application server that contains the sshd_config configuration file>:/etc/ssh/sshd_config /etc/ssh
For example, if the public IP address of the simple application server that contains the sshd_config configuration file is 120.27.XX.XX, run the following command:
scp root@120.27.XX.XX:/etc/ssh/sshd_config /etc/ssh
Run the following command to restart the sshd service:
systemctl restart sshd
Roll back the system disk based on a snapshot
If you created a snapshot for the simple application server, you can roll back the corresponding disk of the server based on the snapshot. For more information, see the "Roll back a disk based on a snapshot" section in the Manage snapshots topic.
Check whether you can connect to the Linux simple application server. For more information, see Connect to a Linux server.