Fix SSH "Connection refused" / "Connection timed out"
ssh: connect to host port 22: Connection refusedConnection timed out"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.
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:
- You're using the correct public IP (not an old or internal one).
- The server's firewall allows your port (22 by default).
- Any provider/cloud firewall or security group allows SSH.
- 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.
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.
Related articles
Fix "Permission denied" on Linux (chmod & chown Explained)
"Permission denied" on a script or file? Understand chmod/chown and fix it the right way.
Read fix Linux & VPSHow to Check CPU, RAM & Disk Usage on a Linux Server
The essential commands to check CPU, RAM and disk on Linux — and find what's eating them.
Read fix Linux & VPSEssential Linux Commands for Game Server Admins
A practical Linux cheat sheet for running a game server on a VPS — files, processes, screen, services and logs.
Read fix