14

I have a Raspberry Pi 1 Model A running an image of Raspbian Stretch Lite.

I've noticed that when I power on my pi and allow it to start up, I can't seem to SSH into it from my Mac laptop. First, I have to hook my RPi up to a keyboard and monitor, log into it (with the default pi user, which is fine for now), and then effectively "bounce" SSH manually:

sudo service ssh stop
sudo service ssh start

Once I do this, I can then SSH into the RPi (from my Mac) without any problems.

I believe this means SSH is not running by default at startup. How can I confirm this is the case, and how can I fix it so that I can have the following dev/test cycle:

  1. Power on the pi
  2. Give it a minute or two to boot up
  3. SSH into it from my Mac

Any ideas?

16

The easiest way to do this for a headless setup, is to create a new file called "ssh" on the SD card. This will enable the SSH daemon immediately after the first boot.

This and more for the headless setup can also be found on the Raspberry Pi forum: https://www.raspberrypi.org/forums/viewtopic.php?t=191252

  • 1
    I just confirmed that this procedure works as expected on the RPi A using a fresh raspbian stretch install. – bobstro Sep 29 '17 at 21:33
  • 4
    Does NOT work on November raspbian stretch – decades Jan 25 '18 at 15:18
  • 1
    The documentation says this in this link raspberrypi.org/documentation/remote-access/ssh/README.md – UselesssCat Mar 25 '18 at 22:58
  • I just confirmed this procedure on my Linux PC where I had the microsd card mounted under /media/fred. I issued the commands: cd /media/fred/boot then touch ssh Then I unmounted the microsd card, removed it from my PC and then inserted it into my Raspberry Pi and booted the Pi. I could then ssh to the Pi from my Linux PC. e.g. ssh pi@192.168.0.2. This is on raspbian stretch lite on a Raspberry Pi 3B. – Will Mar 3 at 7:55
13

Have you created a file in the /Boot directory called "ssh" with no extension?

or setting from

sudo raspi-config 

then -> interfacing options -> enable ssh

EDIT enter image description here

  • Thanks @Dr.Rabbit (+1) - but two concerns: (1) I have alreadymanually provisioned certain parts of my Raspbian distribution (installed Java, deployed certain apps/files to particular locations on the file system, used systemd to create/manage certain services for me, etc.)...will running sudo rasp-config undo any of the settings I've already configured manually? In other words: does it "wipe the slate clean" so to speak? And (2) according to this link there is no "Interfacing Options" menu off of the raspi-config main menu, any thoughts? – smeeb Sep 29 '17 at 11:37
  • No it doesnt touch any settings you dont, think of it like a bios screen – Dr.Rabbit Sep 29 '17 at 11:40
  • Ahhh you're talking about a PiZero, I have a 1 Model A, I don't think my version works the same as yours. – smeeb Sep 29 '17 at 11:51
  • Oh im sorry I thought they all ran the same config app, any creating the file manually should solve it – Dr.Rabbit Sep 29 '17 at 12:02
  • They do all run the same config app. It's part of the OS, which is the same for all models. – goldilocks Oct 4 '17 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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