2

I have wasted a complete afternoon thinking my mac or my router was broken whilst trying to solve this scenario:

Setting up a raspberry pi 3 with a completely new OS (raspbian jessie lite). The pi was hooked up via ethernet and I tried to access it over my mac with SSH and a 192.168.x.x ip that was correctly assigned to the pi via my router. And, of course, I was in the same network as the pi. The ssh connection returns with

Connection refused

I am only writing all this down because I am furious for not having found the answer earlier and in the hopes that someone who might have the same issue gets there quicker!

closed as unclear what you're asking by roaima, Jakuje, Anthon, Kusalananda, Toby Speight Jun 1 '17 at 17:03

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • So... is this a question that needs an answer or an answer that's posed as a question? – roaima Jun 1 '17 at 12:26
  • I guess the second one. I have answered my own question for documentation purposes. But since Stackexchange does grant me the option to answer my own question in the same form where I would create the question I guess this is legit. – hurrtz Jun 1 '17 at 12:33
  • 1
    I see there's a vote to close this - but I think the answer about the ssh file on the /boot partition is valuable, so I think it's worth leaving open - I couldn't find a duplicate anywhere (which I think would be the only reason for closing it). – EightBitTony Jun 1 '17 at 13:26
3

You need to create blank file called ssh in the /boot partition of your Rpi.

For example:

When you load SDcard on laptop, and do fdisk -l /dev/mmcblk0

Disklabel type: dos
Disk identifier: 0x2f47f929

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1           1   125000   125000   61M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      125001 30253055 30128055 14.4G 83 Linux

Now sudo mount /dev/mmcblk0p1 /mnt and cd /mnt && touch ssh.

Then umount /mnt place sdcard on rpi, and check again.

  • This seems to be the correct answer as this is what the Raspberry Pi Foundation officially proposes: raspberrypi.org/documentation/remote-access/ssh – hurrtz Jun 1 '17 at 12:19
  • Exactly. From there I've learned it. They made it like this to prevent iot attacks and stuff, coz ssh was enabled by the default on headless installations. – fugitive Jun 1 '17 at 12:22
0

Enable SSH on the Raspberry Pi! There is no darn SSH listener on the pi as long as it is not enabled.

Or a little more detailed:

  • log into the raspberry pi via keyboard (since SSH obviously is not yet working)
  • set password for root (sudo passwd root)
  • log into root (su or exit and log in with root user)
  • raspi-config

I cannot believe it took me that long. All of this because of since November 2016 Jessie has SSH disabled by default... Hopefully this answer gets to some folks who can cut some serious time with entry...

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