ssh port 22 Connection refused Linux Origin: Platform & cloud Last updated 12 Oct 2026

ssh: connect to host x port 22: Connection refused

The server answered, but nothing is listening on the SSH port — sshd isn’t running, it uses another port, or a firewall actively rejects.

Exact message you may see ssh: connect to host port 22: Connection refusedport 22: Connection refusedConnection refused (ssh)
Seen on: Linux

Meaning

“Refused” means a reset came back, so the host is reachable. Usually sshd isn’t installed/started (fresh VM, container), listens on a custom port, or fail2ban/ufw rejects your IP.

Common causes

  • sshd not installed or not running
  • SSH listening on a non-default port
  • Firewall rule rejecting (REJECT) your IP, or fail2ban ban
  • Connecting to the wrong host/IP

⚡ Quick fix

  1. Check from the console: systemctl status ssh
  2. Use the right port: ssh -p 2222 user@host
  3. Check ufw/fail2ban for your IP

Detailed fix by platform

Linux

  1. bash
    sudo systemctl enable --now ssh   # sshd on RHEL
    sudo ss -ltnp | grep ssh
    sudo fail2ban-client status sshd

How to diagnose

  1. Service — sshd running?
  2. Port — Listening port
  3. Firewall — ufw status / fail2ban banned IPs

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

0x80070035 — 0x80070035: The network path was not found (System error 53) (Windows)0x800700350x80072EE7 — Error 0x80072EE7 (Windows Update / Microsoft Store: server name could not be resolved) (Windows)0x80072EE70x8024402C — Windows Update error 0x8024402C (cannot connect to update server) (Windows)0x8024402C14 UNAVAILABLE — gRPC Error: 14 UNAVAILABLE: No connection established / failed to connect to all addresses (API)14 UNAVAILABLEauth/network-request-failed — Firebase Auth: auth/network-request-failed — A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred (Authentication)auth/network-request-…CDN: trunk URL couldn't be downloaded — [!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/... (iOS)CDN: trunk URL couldn…client_loop: send disconnect: Broken pipe — client_loop: send disconnect: Broken pipe (SSH session drops when idle) (Linux)client_loop: send dis…Download failed — WordPress: Download failed. A valid URL was not provided / cURL error 60 / Could not resolve host: downloads.wordpress.org (WordPress)Download failedssh port …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.