All Products
Search
Document Center

Elastic Compute Service:What do I do if the "Received unexpected end-of-file from SFTP server" error message appears when I log on to a Linux instance by using an SFTP tool?

Last Updated:Feb 20, 2025

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:

  1. Connect to the Linux ECS instance.

    For more information, see Methods for connecting to an ECS instance.

  2. Run the following command to open the SSH configuration file:

    vi /etc/ssh/sshd_config
  3. 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
  4. Run the following command to restart the SSH service:

    systemctl restart sshd.service
  5. 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.