Skip to content
Server and cPanel3 min read

SSH "Connection refused" on port 22: causes and fix

ssh: connect to host example.com port 22: Connection refused

Short answer

Your connection reached the address, but nothing accepted it on port 22, or a firewall explicitly rejected it. Check that your plan includes SSH, that you're connecting to the real server address and the right port, and that your IP address isn't blocked.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Causes
  2. How to fix it
  3. Prevention
  4. On ArabyHost

This error happens before any authentication: your computer never got as far as offering a key or a password. Changing your key won’t help; you need to check the address, the port and the network. Start by reading the exact message:

Message Meaning
Connection refused Reached and rejected at once: nothing listening, or a firewall sent a reject
Connection timed out No answer: a firewall drops packets, the address is wrong, or your network blocks the port
Could not resolve hostname DNS: the name is wrong or doesn’t point anywhere
Permission denied (publickey) Connected fine, authentication failed; see that error’s page

Causes

  • Your plan doesn’t include SSH, so nothing accepts SSH connections for that account.
  • You’re connecting to the wrong address: the domain points to another server, or to Cloudflare’s proxy, which forwards web traffic but not SSH.
  • Wrong port: a command copied from a guide uses something other than port 22.
  • Your IP is temporarily blocked after repeated failed logins over SSH, FTP or cPanel.
  • Your network (office, university, some ISPs) blocks outbound port 22.
  • The SSH service is briefly down for maintenance, which is rare.

How to fix it

1. Confirm the address

dig +short example.com

Or use the DNS lookup tool, and compare the result with the IP shown in cPanel under General Information. If you get a Cloudflare address, connect to the server IP directly or to a subdomain that isn’t proxied (see using Cloudflare with your hosting).

2. Test the port

On Linux and macOS:

nc -vz example.com 22

On Windows, in PowerShell:

Test-NetConnection example.com -Port 22

3. Connect verbosely

ssh -v -p 22 [email protected]

Replace the IP with your server’s and cpuser with your cPanel username. -v shows exactly where the connection stops.

4. Try another network

Connect through your phone’s hotspot. If that works, the original network is the problem: it either blocks the port or its IP is blocked. When an IP is blocked, your website may also fail to load from that network while it loads fine on mobile data.

5. Ask for the block to be lifted

Find your network’s public IP and send it to support with the time of your last failed attempt.

Prevention

  • Use key login and ~/.ssh/config, so you never pile up failed password attempts.
  • Update passwords saved in old FTP or sync apps; they retry automatically in the background and trigger blocks without you noticing.
  • If your domain is behind Cloudflare, keep a DNS-only subdomain for SSH.

On ArabyHost

SSH is available only on the AI/Developer plans, on port 22, inside CageFS. Shared hosting and WordPress plans don’t include SSH, so this message is expected there; you can compare plans on the pricing page. Repeated failed logins can make the firewall block your IP temporarily, as protection against brute-force attacks; contact support to have it lifted. For the full setup, see the SSH access guide.

FAQ

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

Refused is an immediate answer: the address was reached but the port didn't accept the connection. Timed out means no answer came back at all, usually because a firewall drops the packets, the address is wrong or your network blocks the port.

Why does SSH work from my phone but not from home or the office?

Either that network blocks outbound port 22, or its public IP was temporarily blocked after failed logins. Send that public IP to support so they can check for a block.

Can I SSH through a domain proxied by Cloudflare?

Not through the orange-cloud proxy, which only forwards web traffic. Connect to the server's IP directly or to a subdomain set to DNS only.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.