SFTP connection issue

Jonathan 380 Reputation points
2026-09-15T03:14:49.5433333+00:00

Hi,

On Filezilla I created a new site and put 22 as the port to link to SFTP server (using server 2022) why got this issue?

Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server" Error: File transfer failed Error: Got read socket error: ECONNABORTED Error: File transfer failed after transferring 1,898,971,136 bytes in 89 seconds

Windows for business | Windows Server | Networking | Network connectivity and file sharing
0 comments No comments

2 answers

Sort by: Most helpful
  1. Chen Tran 13,030 Reputation points Independent Advisor
    2026-09-15T04:07:11.9966667+00:00

    Hello Jonathan,

    Thank you for posting question on Microsoft Windows Forum!

    Based on the issue description as well as the provided error message. Well! The issue is not that you configured FileZilla wrong. It might be that the connection abruptly died during a heavy transfer (ECONNABORTED), and when FileZilla automatically tried to reconnect, the server actively rejected it (ECONNREFUSED).

    Since Windows Server 2022 uses the built-in OpenSSH server for SFTP. Sometimes, transferring large files at high speeds can cause the sshd (OpenSSH) service to crash or hang. When FileZilla tried to reconnect, the service was no longer listening, resulting in ECONNREFUSED. The suggestion is to log into your Windows Server 2022 machine, open Services (services.msc), and look for OpenSSH SSH Server. If it says "Stopped," start it. In case it says "Running," right-click and restart it. For more information https://learn.microsoft.com/nb-no/windows-server/administration/openssh/openssh_install_firstuse

    If the connection dropped exactly at that file size, the server might have forcibly closed the connection because it could not write any more data. Try to check the destination drive on the server. Make sure it is not completely full, and verify that there are no user storage quotas applied to the Windows account you are using for SFTP. On the other hand, since SFTP transfers everything over a single connection. During very fast, large file transfers, the client and server sometimes fail to exchange "keep-alive" messages because the channel is saturated with file data. The server assumes you dropped off and severs the connection. The suggestion here is to extend FileZilla timeout settings. In FileZilla, navigate to Edit > Settings > Connection. Increase the Timeout setting from the default (20 seconds) to 60 or 120 seconds.

    Another point worth mentioning here is that many enterprise firewalls, antivirus programs, or cloud security groups monitor traffic. If they see a massive, continuous stream of encrypted data (almost 2GB in 89 seconds is ~21 MB/s), they may classify it as a data exfiltration attack and aggressively kill the connection. Worse, they may temporarily ban your IP address, causing the immediate ECONNREFUSED on the reconnect attempt. It is worth checking the firewall logs on the server or your network's perimeter firewall. You may need to whitelist your IP address or create an exception for large SFTP transfers.

    Hope the response provided some helpful insight. If you find this answer useful, please feel free to hit “Accept Answer” so I know it addressed your concern.

    Was this answer helpful?


  2. AI answer

    2026-09-15T03:15:06.6733333+00:00

    For an SFTP connection to a Windows Server 2022 host, ECONNREFUSED - Connection refused by server usually means the server is not accepting the connection on the target port.

    Use this checklist:

    1. Verify the server is using SFTP, not FTP/FTPS.
      • In FileZilla, the protocol must be SFTP - SSH File Transfer Protocol.
      • SFTP normally uses port 22.
    2. Confirm the OpenSSH Server service is running on Windows Server.
      • If the OpenSSH Server service does not start, or SFTP connections hang, validate the configuration with:
             sshd -t
        
      • Also review Event Viewer for related events.
    3. Check the OpenSSH configuration.
      • In sshd_config, make sure the following entry is present and correctly formatted:
             Subsystem sftp sftp-server.exe
        
      • Make sure there are no trailing spaces or invalid entries in sshd_config.
    4. Restart the OpenSSH Server service after any config change.
         NET STOP "OpenSSH SSH Server" && NET START "OpenSSH SSH Server"
      
    5. Enable SFTP logging to capture the refusal cause.
      • Edit %ProgramData%\ssh\sshd_config
      • Set:
             SyslogFacility LOCAL0
             LogLevel DEBUG3
        
      • Add or update:
             Subsystem sftp sftp-server.exe -f LOCAL0 -l DEBUG3
        
      • Restart the service.
      • Then review logs in %ProgramData%\ssh\logs.
    6. If authentication is failing after connection starts, check key and permission settings.
      • For key-based auth, store admin keys in C:\ProgramData\ssh\administrators_authorized_keys and verify permissions.
      • If the server refuses the key, add:
             PubkeyAcceptedKeyTypes +ssh-rsa
             HostKeyAlgorithms +ssh-rsa
        
      • Restart the OpenSSH Server service after making the change.
    7. If transfers start and then abort, check permissions on the SFTP directories.
      • Make sure ChrootDirectory points to a local directory, not a UNC path.
      • Make sure SYSTEM/Administrators owns the chroot directory.
      • Make sure each user has a writable directory inside the chroot, but does not have write permission on the chroot directory itself.
      • Use icacls in an elevated Command Prompt to verify and repair NTFS permissions.

    The ECONNABORTED after transferring part of the file suggests the connection was established and then dropped during transfer. In that case, the most relevant checks are:

    • OpenSSH service health
    • sshd_config validity
    • SFTP subsystem entry
    • Event Viewer
    • SFTP logging
    • NTFS/chroot permissions

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.