How to solve 'Connection refused' errors in SSH connection?


I have an Ubuntu Server 10.10 32-bit in my home. I'm making SSH connections to it from my PC via Putty.

The problem is, sometimes I'm able to login seamlessly. However, sometimes it gives me an error like this: Network error: Connection refused.

Then, I dont't change anything, try to login a few times more, wait a while and try again. Sometimes I can log in, sometimes I cannot. It seems pretty random to me.

What can I do to solve this?


And Sometimes, Putty gives Network error: Software caused connection abort error after displaying login as: text.

Here is the ping -t output:

Pinging with 32 bytes of data: Reply from bytes=32 time=6ms TTL=64 Reply from bytes=32 time=65ms TTL=6 Reply from bytes=32 time=88ms TTL=6 Reply from bytes=32 time=1ms TTL=64 Reply from bytes=32 time=3ms TTL=64 Reply from bytes=32 time=1ms TTL=64 Reply from...
0 0

Posted 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.


0 0

communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and

Network Error Connection Refused Putty Windows 7

policies of this site About Us Learn more about Stack Overflow the putty network error connection refused raspberry pi company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered

Putty Connection Refused Windows 10

Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can putty network error connection timed out ask a question Anybody can answer The best answers are voted up and rise to the top How to solve 'Connection refused' errors in SSH connection? up vote 51 down vote favorite 14 I have an Ubuntu...

0 0

After finding sshd process inoperative, I noticed that something similar is happening, but instead of a missing module, it was something with sshd_config.

Check status of the daemon:

user1@:/usr/sbin > lssrc -s sshd Subsystem Group PID Status sshd ssh inoperative

Attempt to manually start (using absolute path) :

user1@:/usr/sbin > /usr/sbin/sshd /etc/ssh/sshd_config: line 1: Bad configuration option: penBSD: /etc/ssh/sshd_config: terminating, 1 bad configuration options

Turns out this file was incorrectly removed earlier (prior to sshd restart attempt), but new file was created to be an exact copy of another machine (or so we thought, it was actually a bad copy/paste job). Based on the line 1 error, we updated:

penBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $


# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

Not only can we now connect properly, the configuration change we were trying to make...

0 0

I would suggest the following in addition to the answers already present. Ensure you have some way to restore you're firewall after carefully checking its ruleset.

Disclaimer: if this device is an internet facing machine, this will drop all firewall protection from all interfaces, and could lead to your box getting owned.

# iptables --flush # iptables -P INPUT ACCEPT # iptables -P FORWARD ACCEPT # iptables -P OUTPUT ACCEPT # /etc/init.d/openssh-server restart

Then retry connection via ssh, if that fails check /var/log/auth.log.

You can also use

# lsof -i TCP:22

to see if the ssh port is opened and what IP address it's listening on.

edit: re: update, that doesn't appear to be ssh related (it seems to be in relation to sudo privilege elevation.

try tail -f /var/log/auth.log while attempting to connect via ssh.

Connection refused mean that the connection was explicitly rejected by either a firewall or the daemon it's self.


0 0

Simple Way to Fix ssh connection refused Error

Do you encounter ssh connection refused?

Thessh connection refused are used by windows operating systems to alert programmers and system users to a problem. There are thousands of different error codes, found in hundreds of places throughout a computer. They often need a deep IT background to decode and to fix, but many can be repaired through simple, step-by-step solutions either found online or with the help of support personnel.

The error code show up on your computer screen as numbers or number/letter combinations that correspond to the particular error or type of error occurring. Many of the common Windows Errors can be resolved with a quick search, but more complex or obscure errors need help from someone who is well trained in the Windows operating system. Windows error codes do not provide precise, actionable information, but are general codes provided to offer a starting point for a solution. With...

0 0
0 0

Starting from scratch, I googled how to connect to a mysql database over ssh using node.js and the mysql library, and I came across this:

Node.js connecting through ssh

So I started a "screen" session, connected with the ssh command, and created the connection in a node script. However, I was getting an error. A comment below the accepted answer had the same issue:

I'm using a mac terminal, I typed 'screen', entered in the information you provided with my domain and password,and succesfully connected into my server via ssh. However, when I run my server.js node file the problem still persists. I'm receiving: { [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', fatal: true } Is there a step here that I missed? I'm able to query successfully with this code on servers that don't require ssh.

And the response led me somewhere but did not completely explain what I need to do:

After you connected via...
0 0

Are you looking for the solution to fix ssh Connection refused error.

When you connect to your remote host using the ssh command as below.

#ssh user1@myserver1

You will get an error as,

ssh: connect to host myserver1 port 22: Connection refused

Here are the few reason behind the issue of "ssh Connection refused" and its solution.

Possibilities: You don't have an SSH daemon running on your remote server or connection been blocked by firewall settings.

1. Depending on what distribution installed, you may need to install or run the ssh server, usually called openssh-server or sshd depending on your package manager.

2. Allow ssh port 22 on firewall to accept the connection from other server.

Leave your inputs if anything missed and we appreciate your comments. ssh Connection refused how to troubleshoot, ssh Connection refused fix, ssh Connection refused linux, ssh Connection refused ubuntu, ssh Connection refused port 22,...

0 0
# # /etc/hosts: static lookup table for host names # # localhost.localdomain localhost ::1 localhost.localdomain localhost localhost.localdomain localhost # End of file # $OpenBSD: ssh_config,v 1.26 2010/01/11 01:39:46 dtucker Exp $ # This is the ssh client system-wide configuration file. See # ssh_config(5) for more information. This file provides defaults for # users, and the values can be changed in per-user configuration files # or on the command line. # Configuration data is parsed as follows: # 1. command line options # 2. user-specific file # 3. system-wide file # Any configuration value is only changed the first time it is set. # Thus, host-specific definitions should be at the beginning of the # configuration file, and defaults at the end. # Site-wide defaults for some commonly used options. For a comprehensive # list of available options, their meanings and defaults, please see the # ssh_config(5) man page. # Host * # ForwardAgent no # ForwardX11 no...
0 0