FTP connection refused – quick fix for hosting servers
Your FTP client says 'connection refused' when trying to reach your hosting server. Usually it's a firewall or port issue, or the FTP service isn't running. Here's how to fix it.
When this error shows up
You're using FileZilla or WinSCP to upload files to your hosting server. You enter the hostname, username, password – everything looks right. Then you get: Connection refused (ECONNREFUSED) or sometimes Error: 421 Service not available. The FTP client just sits there, waiting. Nothing happens. You try again, same thing. I've seen this at least a dozen times with shared hosting accounts and small VPS setups.
What's actually going on
When your FTP client tries to connect to port 21 (the default FTP port), the server isn't answering. It's like calling a phone that's off the hook. The server's firewall is blocking the connection, or the FTP service (like ProFTPD or vsftpd) isn't running. Sometimes it's because the hosting provider changed the port – some put it on 2221 or something weird. Another common cause: your home or office firewall is blocking outbound traffic on port 21. But I'd bet on the server side first.
One time, a client called me frantic because his entire e-commerce site wouldn't update. Turned out his hosting company had silently switched to SFTP (port 22) and turned off regular FTP. The error was the same: connection refused. He'd been banging his head for two hours.
How to fix it – step by step
Step 1: Test the port from your end
Open a command prompt or terminal. Run this to see if port 21 is reachable:
telnet yourhostingdomain.com 21
If you see a blank screen or a message like 220 ProFTPD 1.3.5 Server ready, then the port is open. The problem is on your client's side – maybe passive mode settings. If you get Connection refused or Unable to connect, the server's firewall or service is the issue.
Step 2: Check if your hosting provider uses SFTP or FTPS
Log into your hosting control panel (cPanel, Plesk, etc.). Look for FTP settings. Many modern hosts now force encryption. Try connecting with SFTP on port 22 instead. In FileZilla, set Servertype to SFTP – SSH File Transfer Protocol and use port 22. Or try FTP over TLS (explicit) on port 21. If that works, the server's blocking plain FTP.
Step 3: Whitelist your IP in the firewall
If you have root access to the server (VPS or dedicated), check the firewall rules. For a Linux server with iptables:
sudo iptables -L -n | grep 21
If you see DROP rules, add your IP to the whitelist. For cPanel servers, the firewall is often managed by CSF (ConfigServer Security & Firewall). Log into WHM, go to CSF, and add your IP to the Allow IP list. A common mistake: the firewall only allows specific IP ranges. Had a client last month whose hosting company accidentally blocked all IPs except their office's.
Step 4: Restart the FTP service
If the service crashed (happens more than you'd think), restart it. On a Linux VPS:
sudo service vsftpd restart
# or for ProFTPD:
sudo service proftpd restart
Check if it's running with:
sudo systemctl status vsftpd
If you don't have root access, contact your hosting provider and say, "My FTP connection is refused. Can you restart the FTP service?" They'll usually do it quickly.
Step 5: Switch to passive mode in your client
FileZilla: Edit > Settings > FTP > Passive mode (recommended). Then reconnect. If that doesn't work, try active mode. The difference is how the data channel opens. Passive mode is more firewall-friendly, but some servers force active. I've seen servers that only work with one or the other. Experiment.
What to check if it still fails
Still no luck? Here's my checklist:
- Double-check the hostname. Auto-complete sometimes uses wrong URLs.
- Try with the server's IP address instead of the domain name. DNS might be acting up.
- Check if your home or office router blocks port 21. Temporarily switch to a mobile hotspot to test.
- Look at the server's FTP logs – they're usually in
/var/log/proftpd/proftpd.logor/var/log/vsftpd.log. They'll tell you exactly why it refused. - If you're on a shared hosting plan, some cheap hosts disable FTP entirely without telling you. Call their support and ask directly: "Is FTP enabled on my account?"
- Last resort: use the hosting panel's file manager (cPanel file manager or Plesk file manager) to upload files temporarily. It's clunky but works.
I'd say 90% of the time, the fix is either using SFTP or whitelisting your IP. Don't waste hours on client settings – start with those two. If you still get the error after all this, it's likely a server-level issue your host needs to fix. Send them the error code and the telnet test result. They'll take it seriously.
Was this solution helpful?