Linux & VPS

Fix SSH "Connection refused" / "Connection timed out"

ssh: connect to host port 22: Connection refusedConnection timed out
6 min read Updated 12 June 2026 ESAGAMES Team

"Connection refused" and "Connection timed out" look similar but mean very different things. Knowing which you have tells you exactly where the problem is — and how to fix it.

Refused vs timed out

Connection refused = you reached the server but nothing is listening on the port (SSH down/wrong port). Connection timed out = you never reached it at all (firewall, wrong IP, or the host is offline).

If it says "Connection refused"

The server answered, but the SSH service isn't listening on that port. Through your provider's console/VNC, check the SSH daemon is running and on the expected port:

systemctl status sshd      # is it running?
systemctl start sshd       # start it if not
ss -tlnp | grep ssh        # what port is it on?

If SSH runs on a non-standard port, connect with -p:

ssh -p 2222 user@your-server-ip

If it says "Connection timed out"

Packets never reach SSH — almost always a firewall or a wrong address. Check, in order:

  1. You're using the correct public IP (not an old or internal one).
  2. The server's firewall allows your port (22 by default).
  3. Any provider/cloud firewall or security group allows SSH.
  4. The server is actually powered on (check the panel).

On the server (via console), allow SSH through the firewall:

# firewalld (CentOS/Rocky/Alma)
firewall-cmd --permanent --add-service=ssh && firewall-cmd --reload

# ufw (Ubuntu/Debian)
ufw allow 22/tcp && ufw reload

Locked out completely?

If you can't SSH in at all, use your provider's VNC / serial console from the control panel — it bypasses SSH and the network entirely, so you can fix the firewall or restart the daemon from there.

Read the exact word: "refused" is a service problem on a reachable server; "timed out" is a network or firewall problem before you ever reach it.

A VDS with console access

Our VDS plans include VNC console access, so you're never locked out — on protected NVMe infrastructure in Frankfurt.

See VDS plans
FAQ

Frequently asked questions

Why does SSH say "connection refused" but the server is online?

The server is reachable but nothing is listening on the SSH port — the sshd service is stopped, crashed, or running on a different port. Start it and confirm the port with ss -tlnp.

What's the difference between "refused" and "timed out"?

Refused means your packets reached the server and were actively rejected (no service on that port). Timed out means they never got a reply at all — usually a firewall dropping them or a wrong IP.

How do I get in if SSH is broken?

Use the VNC or serial console in your hosting control panel. It connects directly to the machine without SSH or the network, so you can fix the problem from inside.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney