ECONNREFUSED on port 22
Meaning of ECONNREFUSED for SFTP/SSH on port 22 and the fastest ways to isolate firewall vs service vs wrong port.
ECONNREFUSED means the TCP handshake was rejected. The host is up, but the port is closed or blocked.
Common causes
- SSH/SFTP service not running
- SSH is on a non-standard port (not 22)
- Firewall/device rejects connections to port 22
Fix checklist
- Confirm SSH is listening on port 22 (or the configured port).
- Verify inbound firewall rules allow your source IP.
- If the server is internal-only, run checks from inside the network/VPN.
Quick commands
nc -vz <host> 22
ssh -vvv <user>@<host> -p 22Related
- TCP connection failed — General TCP failure causes when connecting to FTP, FTPS, or SFTP services.
Diagnostics powered by FTPMonitor CLI