ECONNREFUSED on port 21
Why FTP port 21 returns connection refused, and how to isolate service-down vs firewall vs wrong host/port.
ECONNREFUSED means the host responded and actively rejected the TCP connection.
This usually indicates the service isn’t listening on that port, or a device is rejecting connections.
Common causes
- FTP service is not running/listening on port 21
- Wrong host or wrong port (FTP may be on a non-standard port)
- Firewall/device sends RST (reject) instead of dropping traffic
Fix checklist
- Confirm FTP is enabled and listening on port 21 (server-side).
- Confirm the vendor/admin-provided port (FTP is not always 21).
- Check firewall/security group rules for explicit rejects.
- Try from inside the same network/VPN if the host is internal-only.
Quick commands
nc -vz <host> 21
telnet <host> 21Related
- TCP connection failed — General TCP failure causes when connecting to FTP, FTPS, or SFTP services.
Diagnostics powered by FTPMonitor CLI