Manu MJ
Posts: 1
Joined: Sat Jan 07, 2017 2:35 pm

Network Error: Connection Refused

Sat Jan 07, 2017 3:11 pm

Hi,

I recently bought Raspberry Pi 3 but I am unable to login I am getting an error as 'network error: connection refused'. I searched before posting it here but still could not fix the issue. I am trying log-in Raspberry Pi using my windows 7 laptop since I do not have a display and keyboard.

I am following the video to login Rpi: http://www.circuitbasics.com/raspberry- ... less-mode/

I did following:
1) Burnt raspbian image to SD card and inserted to Rpi
2) Connected Ethernet cable to internet router (I am able see green led blinking)
3) Used advanced scanner to find Rpi IP to perform SSH using Putty
4) Putty gives error 'network error connection refused'

I tried following troubleshooting:
1) Re-verified Rpi Ip using Kitty tool as well and it is same
2) Used my other windows 7 PC, still same error
3) Turned off windows fire-wall
4) Restarted my router

Please suggest what else need to check, to resolve this issue.

Thanks
Manu
Regards,
Manu

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5118
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Network Error: Connection Refused

Sat Jan 07, 2017 5:21 pm

Have you fallen foul of this change?:
https://www.raspberrypi.org/blog/a-secu ... ian-pixel/
(ie. did you enable the SSH server etc. as per that blog?)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: Network Error: Connection Refused

Sun Jan 08, 2017 10:27 am

As Trev has pointed out it is because SSH is disabled by default in the newer Raspbian images.

Create a blank text file called "ssh" on the root of the SD card using your laptop. Then boot the Pi from it. That will enable SSH.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

wreeve
Posts: 2
Joined: Tue Feb 07, 2017 4:46 am

Re: Network Error: Connection Refused

Tue Feb 07, 2017 4:48 am

Placing the ssh file worked for me with Jessie Lite. Be sure the ssh file has no extension.

Nagaraj
Posts: 1
Joined: Mon Feb 20, 2017 3:55 pm

Re: Network Error: Connection Refused

Mon Feb 20, 2017 4:04 pm

Hello,

Even i am getting the network saying connection refused while trying to connect to raspberry pi via putty and ssh form laptop. i have tried all the methods and i am failed, the above method also i followed but dint work.

I suspect that windows firewall is preventing the SSH connections. Please help me with this problem, i am trying to debug this issue from past one month and failing every time.

Thanks in advance,
Nagaraj

Munneh
Posts: 1
Joined: Mon May 15, 2017 3:47 pm

Re: Network Error: Connection Refused

Mon May 15, 2017 3:50 pm

Hi Nagaraj!

Did u find fix your problem? I think I have the same problem after I updated Windows :(

in3vrr
Posts: 19
Joined: Sat Oct 08, 2016 1:30 pm

Re: Network Error: Connection Refused

Sat Nov 18, 2017 5:41 pm

RPI3 Raspbian GNU/Linux 8 (jessie)Linux 4.9.50-v7+ #1035 SMP with RSA KEY

After sudo apt-get update && sudo apt-get dist-upgrade I configured OpenVPN (with www.vpn.io) .... everything worked with new fiber router ... also worked (installed 6 months ago) SSH with RSA KEY.
Then I installed a Fritz! Box 7490 as a cascaded router on fiber modem (192.168.1.1) and strangely RPi kept IP assigned by the fiber modem even if the Fritz! 7490 LAN works on a separate network (192.168.178.1).
I solved this problem by setting static IP on Rpi
with sudo nano /etc/dhcpcd.conf
At the bottom of the file I entered:
nohook lookup-hostname
nodhcp
interface eth0
static ip_address=192.168.178.32/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.1

Now the RPI can also be reached with PING in LAN but SSH does not even work in Lan (and not even in wan).
# SSH enabled, SSH port enabled
# RSA KEY the usual installed 6 months ago (with fiber router worked)
# Rpi reachable with ping in lan

PROBLEM - with sudo systemctl status ssh.service
i see:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled)
Active: failed (Result: start-limit) since sab 2017-11-18 16:59:38 CET; 38min ago
Process: 1046 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
Main PID: 1046 (code=exited, status=255)

nov 18 16:59:38 RPi3 systemd[1]: Unit ssh.service entered failed state.
nov 18 16:59:38 RPi3 systemd[1]: ssh.service holdoff time over, scheduli...t.
nov 18 16:59:38 RPi3 systemd[1]: Stopping OpenBSD Secure Shell server...
nov 18 16:59:38 RPi3 systemd[1]: Starting OpenBSD Secure Shell server...
nov 18 16:59:38 RPi3 systemd[1]: ssh.service start request repeated too ...t.
nov 18 16:59:38 RPi3 systemd[1]: Failed to start OpenBSD Secure Shell server.
nov 18 16:59:38 BZ-RPi3 systemd[1]: Unit ssh.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

Can I go back and restore the old configuration? befor sudo apt-get update && sudo apt-get dist-upgrade ????
How ???
Thank you
Bob

in3vrr
Posts: 19
Joined: Sat Oct 08, 2016 1:30 pm

Re: Network Error: Connection Refused

Sat Nov 18, 2017 6:04 pm

I also tried with these commands but nothing changed:
sudo service ssh restart

sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server

With sudo sshd -T i see:
/etc/ssh/sshd_config: line 93: Bad configuration option: AuthorizedKeysFiles
/etc/ssh/sshd_config: terminating, 1 bad configuration options

Line 93 is this: AuthorizedKeysFiles .ssh/authorized_keys
the file exists

:roll:

DirkS
Posts: 9970
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Network Error: Connection Refused

Sat Nov 18, 2017 6:27 pm

in3vrr wrote:
Sat Nov 18, 2017 6:04 pm
Line 93 is this: AuthorizedKeysFiles .ssh/authorized_keys
the file exists
It's AuthorizedKeyFile (minus the s)
The default is

Code: Select all

#AuthorizedKeysFile	%h/.ssh/authorized_keys
As you can see it's actually commented out

in3vrr
Posts: 19
Joined: Sat Oct 08, 2016 1:30 pm

Re: Network Error: Connection Refused

Sat Nov 18, 2017 7:09 pm

DirkS wrote:
Sat Nov 18, 2017 6:27 pm
...cut
It's AuthorizedKeyFile (minus the s)
The default is

Code: Select all

#AuthorizedKeysFile	%h/.ssh/authorized_keys
Whouuu thanks a lot ...
I became crazy for a "s"
I'm SSSStupid
Thank you
Have a nice Sunday
Bob

gsn
Posts: 2
Joined: Wed Aug 26, 2015 2:34 pm

Re: Network Error: Connection Refused

Wed Mar 14, 2018 1:20 pm

MattHawkinsUK wrote:
Sun Jan 08, 2017 10:27 am
As Trev has pointed out it is because SSH is disabled by default in the newer Raspbian images.

Create a blank text file called "ssh" on the root of the SD card using your laptop. Then boot the Pi from it. That will enable SSH.



I faced the same issue. but this will made it working

fiazmr
Posts: 2
Joined: Sat Mar 30, 2019 5:40 pm

Re: Network Error: Connection Refused

Sun Mar 31, 2019 4:10 am

After creating the blank ssh file, and inserting it into my pi that was already connected it didn't work. Re-powering the supply and bootup it started working.

Return to “Troubleshooting”