Raspberry Pi headless setup

If you’re banging your head on your keyboard because your Raspberry Pi is pingable but connecting via ssh gives you “Connection Refused” errors, read on.

Buried in an hour of frustration was this post on stackexchange:
https://raspberrypi.stackexchange.com/questions/4444/enabling-ssh-on-rpi-without-screen-keystrokes-for-raspi-config

All you need is to place an empty file named ‘ssh’ onto the boot (FAT) partition of your SD card (no need to mount ext3). Tested with 2016-11-25-raspbian-jessie-lite.img.

Source: https://www.raspberrypi.org/documentation/remote-access/ssh/

Tested this with RASPBIAN JESSIE LITE/Pixel release 2017-04-10. Hope this helps someone save some time.