8

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

Ghanima
  • 15,578
  • 15
  • 58
  • 113
super111
  • 99
  • 1
  • 1
  • 2
  • 1
    Unless you tell us exactly what you did we can't help. – Milliways May 01 '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 01 '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 01 '15 at 21:25
  • 2
    You almost certainly do not need to use a cross-over cable, they are [anachronistic](https://en.wikipedia.org/wiki/Ethernet_crossover_cable#Automatic_crossover). But you do need to check whether SSH is enabled. – goldilocks Jan 27 '17 at 15:06
  • http://stackoverflow.com/questions/16040128/hook-up-raspberry-pi-via-ethernet-to-laptop-without-router It seems to work. Its has detailed the process clearly – Adil May 02 '17 at 14:46

5 Answers5

11

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 !!

5

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

Jeremy
  • 161
  • 1
  • 4
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.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
  • 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 02 '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 03 '15 at 10:38
  • it's raspbian official image – super111 May 05 '15 at 13:35
  • Did you find `/var/log` on the second partition? What's in it? – goldilocks May 05 '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 02 '15 at 07: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 02 '15 at 09: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 02 '18 at 18:31