5

I tried to connect raspberry pi (headless because I have no monitor to use) to an Ubuntu PC using ethernet using link-local setting on the network manager, setting the ip of the pi using "cmdline.txt" file on the boot partition of the SD card. Then I tried to connect to the pi using ssh but I get the message "connection refused".

  • 1
    Unless you tell us exactly what you did we can't help. – Milliways May 1 '15 at 23:12
  • i did exactly as i said nothing more 1-set an ip address for the raspberry pi 2-create a link-local wired connection in network manager 3-connect the raspberry pi to the pc with an ethernet cable 4-try tp create an ssh connection – super111 May 1 '15 at 23:34
  • 1
    You need to make sure SSH is enabled using raspi-config, and you need to use a cross-over cable. – TheXed Jun 1 '15 at 21:25
  • 2
    You almost certainly do not need to use a cross-over cable, they are anachronistic. But you do need to check whether SSH is enabled. – goldilocks Jan 27 '17 at 15:06
  • stackoverflow.com/questions/16040128/… It seems to work. Its has detailed the process clearly – Adil May 2 '17 at 14:46
7

simple way:

  • connect raspberry pi to laptop with Ethernet.
  • Go the edit connection setting.
  • Navigate to ipv4 option. Select method : shared to other computer.
  • Then open command prompt and type command >"cat /var/lib/misc/dnsmasq.leases". You will get raspberry pi Ip from that.
  • then open command prompt and type: ssh pi@"ip of raspberry pi"

Hope this will work !!

  • None of this can possibly help when dealing with "connection refused" issue. – Dmitry Grigoryev Jan 26 '17 at 10:46
  • Did you try this. I don't think so it will give a connection refused issue. – jitendra sonawane Jan 27 '17 at 14:56
  • Someone without the reputation to comment tried to edit "restart the computer" after "navigate to ipv4...", claiming this was necessary for the change to take effect. In my experience network reconfiguration of any sort doesn't require a reboot -- but I am not a Ubuntu network manager user, so I've left this. – goldilocks Jul 25 at 12:03
  • No restart required. – jitendra sonawane Aug 3 at 5:51
4

The comment of @goldilocks points out the solution! +1 for that (as soon as I have enough reputation). Raspbian has the SSH server disabled by default, since November 2016, so you'll have to turn it of first.

Place a file named 'ssh', without any extension, onto the boot partition of the SD card. See here

  • Yep, just access the SD card and $touch ssh. That worked for me. – RichArt Jul 30 '17 at 18:07
1

"connection refused"

Indicates that ssh was allowed to try (i.e., found a node with that IP, and was not stopped by a firewall) but could not connect. One cause of this would be if sshd was not running. You could check the logs about this:

grep sshd /var/log/syslog

Sshd logs any attempted connection, even if it fails. If there is no record there, then it was not running, or you used the wrong IP or port.

  • the problem is i have no monitor to connect the pi to it , but i checked /var/log/ on the sd card and i didn't find the syslog file in it ? – super111 May 2 '15 at 19:34
  • Unless (perhaps) you have upgraded to "jessie", if you cannot find that file, this is a system that has never booted correctly. If you tell me where exactly you got the image I can double check that. – goldilocks May 3 '15 at 10:38
  • it's raspbian official image – super111 May 5 '15 at 13:35
  • Did you find /var/log on the second partition? What's in it? – goldilocks May 5 '15 at 13:36
1

You can always do a portscan to see if ssh is running on port 22. Use nmap to do the portscan for you.

You will have to do this in the command line of your Ubuntu pc. Do connect the Pi to your PC (directly or over your ethernet network at home). Then open the commend line by pressing ctrl + alt + t.

If you don't already have nmap installed on your pc, you can always install it by sudo apt-get install nmap. After installing, do the portscan of ports on the Pi.

nmap [IP adress of your PI] Under the title 'SERVICE' their will be 'ssh' see on the line where 'ssh' is for a port number. Then take that portnumber and do the following.

ssh pi@[IP adress of your Pi] [Portnumber] You will be getting a warning about certificates, type yesand press enter. Then type in your password and you will be logged in.

Note 1: You can look up the IP adress of your Pi on your router if the Pi is plugged into the home network. Otherwise on your Ubuntu PC: System settings -> Network.

Note 2: Where I have used [...] leave out the brackets.

  • I'm sorry, but while this is an excellent description on how to install and use nmap and connect to a working sshd, it does not address the question, which rather seems to be about a non-working sshd. "Connection refused" means there was noone to answer at port 22. There is nothing in the question to indicate that sshd is setup on an unorthodox port. I'm voting this answer down. – Bex Jun 2 '15 at 7:11
  • That is true, but the question was not clear enough. It is always possible that the ssh is running on another port different than 22. I had this problem on my own with changing things on the PI. It is possible that the ssh switches to another port. – user3004449 Jun 2 '15 at 9:59
0

'Connection Refused' is because, by default, RPi has SSH, VNC etc. turned off.

Find a way to connect your RPi to a monitor, use an USB mouse to navigate through the settings and turn them on first.

  • When the question was asked, 2 years and 10 months ago SSH was turned on by default! The policy has changed since then, so now it is turned off by default! – MatsK Mar 2 '18 at 18:31

protected by Darth Vader Sep 24 '18 at 10:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.