Econnrefused - Connection refused by server

If you’re looking for a quick fix to “ECONNREFUSED – Connection refused by server” FileZilla error messages, try changing your port number from 21 (default FTP port) to 22 (default SFTP port) or vice versa, as that is one of the most common fixes.

Then try again to connect to the host IP address or domain you wish to access.

If that doesn’t work or if you’re interested to learn why it worked, keep reading as we’ll cover that fix and other common solutions to this issue here.

FileZilla Econnrefused Connection refused by server error

Why FileZilla cannot connect with the server?

FileZilla is a popular, free, and open-source FTP, FTPS, and SFTP client used to upload and download files. “ECONNREFUSED – Connection refused by server” is one of the more common errors that users of FileZilla may encounter. You’ll know you’ve gotten this error when you see something similar to this displayed after a connection attempt:

Status:       Connecting to someserver:21...
Status:       Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error:        Could not connect to server
Status:            Disconnected from server

This error can occur for a variety of reasons, so a fix that works for one person may not work for another. Below we’ll run through a number of possible causes of this message and ways to resolve them.

FileZilla Client Free Download

FileZilla Server Free Download

You’re using the wrong port

If we use StackOverflow as a reference one of the simplest solutions to this problem is one of the most common. FTP and SFTP serve similar purposes but have a few key differences. Two of the main differences are:

  • FTP is NOT encrypted by default and uses port 21 by default, while
  • SFTP is encrypted by default and uses port 22 by default.

Sometimes, simply switching the port you are using can resolve the ECONNREFUSED message. It’s more common that switching from port 21 to 22 resolves the issue since port 21 is often blocked by ISPs and IT teams. However, it’s possible a switch from port 22 to port 21 may resolve your issue too.

To change a port number in FileZilla, simply input the numerical value in the Port: field as illustrated below in the control panel.

FileZilla Change Port

Explicit and Implicit FTPS

It’s worth noting that explicit FTPS often uses port 21, but implicit FTPS uses port 990. For those of you unfamiliar with the two FTPS types, check out this FileZilla Wiki. In short, explicit FTPS is the more modern version and starts with a standard FTP connection, while implicit FTPS listens on a separate port and assumes the connection is encrypted from the beginning.

You should also keep in mind that it is possible that the site administrator changed the default port for the site and you’ll need to use a non-standard port number. To confirm if that is the case, contact the site’s administrator (or keep reading to learn about some port scanners that might help).

Something is blocking the connection

As we alluded to in the solution above, sometimes a port being blocked can be the root cause of your issue. You can do the following to check if your connection is being blocked:

  • Make sure your firewalls allow outbound traffic from the computer running the FileZilla client to TCP port 21 or 22 (or whatever port you’re using) on the file server.
  • On the server-side, make sure inbound connections to TCP port 21 or 22 (or whatever port you’re using) are allowed.
  • On the server-side, make sure your file server is listening on the desired port. The “netstat” command we covered in our network troubleshooting tools article might be helpful here.
  • Make sure local firewalls (e.g. Windows Firewall) or antivirus programs are not interfering with your connection or blocking the “filezilla.exe” application.

If you need to drill down further and check what ports are open on the file server over the network, consider using a tool like nmap to troubleshoot. If nmap is too advanced for you to use, review our definitive guide to nmap or consider using SolarWinds Open Port Scanner which is part of the Engineer’s Toolset.

Note: While bumper stickers and t-shirts will tell you port scanning isn’t illegal, if you’re looking to err on the side of caution, only run port scanners against servers you are authorized to scan.


If you are the administrator of the server that’s having issues and you suspect configuration is part of the problem, you might want to test out other SFTP/FTPS servers. If that is the case, check out our article on the best SFTP/FTPS servers.

You need to add “ftp.” to the FQDN

If you are a website administrator and use services like SiteLock or Sucuri Website Firewall for your site, you may need to add “ftp.”  to the beginning of your Fully Qualified Domain Name (FQDN) to make a successful connection using FileZilla and other file transfer clients.

FileZilla Add FTP

Kudos to HostPapa for this tip. If you’re looking for other ways to resolve this issue or issues like “Response: 421 Too many connections (#) from this IP”, specifically those related to third-party hosting sites, check out their knowledge base article on the topic.

You need to use Passive Transfer Mode/Active Transfer Mode

For the sake of brevity, I won’t dive into the differences between Passive Transfer Mode and Active Transfer Mode. However, if none of the tips above helped you resolve the issue and you’re using FTP or FTPS, switching your transfer mode might help.

To change the default Active/Passive transfer mode setting for your FTP transfers, follow this process:

  1. Launch FileZilla.
  2. Click Edit > Settings.
    FileZilla Edit Settings
  3. Under Connection, click FTP.
    FileZilla Connection FTP
  4. Select the radio button for the desired transfer mode. Generally, we’d also recommend checking the ‘Allow fall back to other transfer mode on failure‘ box (should be checked by default). In the example below, we’re selecting passive transfer mode with the ‘Passive (recommended)‘radio button.
    FileZilla Passive Mode Selected

After making these changes, try connecting to the site again.

ECONNREFUSED Error FAQs

I have a different ECONNREFUSED message - "the data connection could not be established", is the fix the same as in your guide above?

The main cause of “the data connection could not be established” message when using an FTP server lies in the settings of the FTP tool used to connect to the server from a remote machine. This message is particularly common when using Passive mode, which places most of the connection establishment tasks into the server’s responsibility. It could be that your client is only working with a non-routable local IP address, but trying to communicate with a remote FTP server across the internet. Another possible reason lies with blocking software on the client device, such as a firewall.

Let us know if these tips helped

That’s our list of common causes of, and solutions to, the FileZilla error “ECONNREFUSED – Connection refused by server”

Did these suggestions work for you? Do you have other tips or questions related to this issue? Let us know in the Comment section below.