This topic describes how to resolve the issue that the "Received unexpected end-of-file from SFTP server" error message appears when you use a Secure File Transfer Protocol (SFTP) tool to log on to a Linux Elastic Compute Service (ECS) instance.
Problem description
When you use an SFTP tool to log on to a Linux instance, the "Received unexpected end-of-file from SFTP server" error message appears.
Cause
In most cases, the preceding issue occurs because SFTP is disabled in the SSH configuration file (/etc/ssh/sshd_config) of the Linux ECS instance.
Solution
Perform the following steps to enable SFTP in the SSH configuration file:
Connect to the Linux ECS instance.
For more information, see Methods for connecting to an ECS instance.
Run the following command to open the SSH configuration file:
vi /etc/ssh/sshd_config
To enable SFTP, find the line of code that contains the following configuration and delete the number sign (#) from the beginning of the line to uncomment the line:
#Subsystem sftp /usr/libexec/openssh/sftp-server
Run the following command to restart the SSH service:
systemctl restart sshd.service
Log on to the Linux ECS instance. If the issue is resolved, you can log on to the instance by using the SFTP tool as expected.