•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

SSH Connection refused

  • Home
  • Client
  • Qa Forum
  • SSH Connection refused

Posted By: Henry | 1 Replies | Last Reply On: Oct 15, 2017 03:39:54

I keep getting the error below and would appreciate it if someone can provide some steps to fix it -

ssh: connect to host  port 22: Connection refused

 

Psychz - Raviteja

Votes: 0Posted On: Oct 15, 2017 03:39:54
 

You can get this error due to multiple reasons. The SSH connection might be refused either at the router, your firewall or there might be a problem with the SSH daemon. Here are some of the steps you can take to troubleshoot this problem. Here we are troubleshooting the problem on Ubuntu operating systems. 


Check your SSH daemon

Check the status the SSH daemon installed on both machines.

sudo service ssh status   
sudo service ssh start
 

If the status is active and running, then we move onto the other diagnosis. But if the SSH daemon is not installed on either of the machines, we have to reinstall the SSH daemon.

sudo apt-get remove openssh-client openssh-server
sudo apt-get install
openssh-client openssh-server

Try and connect through SSH now. If the problem is resolved, you don't need to proceed further. If not, move on to next steps.


Firewall Settings

The SSH daemon might be blocked by your internal firewall(iptables in this case). Please check your iptables to check that the port 22 is not blocked.

sudo iptables -L

If the port 22 is blocked, please run the following command to allow the SSH traffic.

sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT


Change the SSH port

Sometimes, the default port of SSH i.e Port 22 is blocked by the iptables or the ISP. Please change the port and restart the SSH service. You can do so by changing the SSH configuration file which is stored in "/etc/ssh/sshd_config". Edit the file using any editor of your choice. Here is sample shot of the file.


I am sure this will help in resolving your problem.

Was this reply helpful?

Related topics

  • How to generate SSH Keys on Linux?
  • Unable to Access The Server Via SSH
  • Dedicated with good connection to south america
  • ssh_exchange_identification connection closed by remote host
  • How to remotely connect to a Linux machine using a smartphone?
  • SSH Reverse Tunnel
  • SSH File Transfer
  • SSH Agent Forwarding
  • cVirtual Connect from Windows
  • SSH Keys - Create
  • DDoS Extortion: The Latest Nefarious Twist on Cyber Crime
  • Single vs Dual vs Multi-homed Network
  • Best 10Gbps Unmetered Dedicated Server In North America - Top 10 List
  • Best 10Gbps Unmetered Dedicated Servers - Top 10 List
  • Why Gaming Companies are Choosing Bare Metal Servers
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801