[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedJuly 14, 2023

How to Fix “Connection Refused by Port 22” on Debian/Ubuntu.

How To Fix “Connection Refused By Port 22” On Debian/Ubuntu.

In this article we will explore different ways we can resolve the Connection Refused issue on an Ubuntu/Debian system.

Verify OpenSSH Installation

First, check if OpenSSH is installed on your system or not. The command mentioned below will verify it.

sudo apt list --installed | grep openssh-server

In case OpenSSH is not installed, we will install it by executing the following command:

sudo apt install openssh-server

 

Check SSH Service

Let’s now check what’s the status of the SSH service on our system. It should be active or in the running state. The reason why you are getting a connection refused error could be the inactive state of SSH on your system. Run the following command to check the status:

sudo service ssh status

The output tells us it is in the active (running state).

If your SSH service is inactive, you can start it by executing the following commands:

sudo service ssh start
sudo service ssh restart

Check SSH Server Listening Port

Before trying to connect, first, verify which port is being used by the SSH server to listen to new connections.

ssh [username]@[remoteserver IP or hostname]

Issue the following command to check on which port the OpenSSH server is listening:

sudo netstat -ltnp | grep sshd

As we can see 22 port is in use by OpenSSH to listen to connections.

In case, some other port is being used in place of 22, you will issue the command like this:

ssh -p [Port] [username]@[ip_address]

 

Allow SSH in Firewall

To allow the port through firewall, execute this command:

sudo ufw allow port /tcp

If a port other than 22 is being used, you will issue the command like this:

sudo ufw allow 2244/tcp

Once the rules are updated, you will get this output on the terminal:

Reload the firewall with this command to update the rules:

sudo ufw reload

Now check the status of firewall to verify if the SSH port has been allowed or not.

sudo ufw status

You will see the following message if you are using port 2244 for SSH:

 

Conclusion

In today’s guide, we discussed several reasons that could be causing the Connection refused error and several ways to resolve this issue.

Keep reading
How to install Qemu guest agent for CentOS
February 21, 2023

How to install Qemu guest agent for CentOS

How to install Qemu guest agent for CentOS In this article, we will help you to install the Qemu guest agent on your virtual private server. This agent is a helper daemon that exchanges information between the quest and the host and executes commands in the guest for snapshot or backup. The guest…

Read article
How to perform and read a traceroute on Linux and Windows
February 21, 2023

How to perform and read a traceroute on Linux and Windows

How to perform and read a traceroute on Linux and Windows To run traceroute on a Linux system, do the following: Open up an instance of Terminal. Type in the phrase “traceroute [hostname]” and press enter. On a Windows system, you can: Go to the Start menu. Select Run. Type in “cmd” and then…

Read article
How do I make a RAID array inside Windows?
February 21, 2023

How do I make a RAID array inside Windows?

How do I make a RAID array inside Windows? Log in to your server Log in to your server by KVM or RDP (remote desktop). Log in to your control panel Open up your control panel, and change “View by” to either “small icons” or “large icons”. Execute actions Click on “Administrative Tools” and then…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00