17

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?

smeeb
  • 645
  • 3
  • 9
  • 22

3 Answers3

17

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

Dr.Rabbit
  • 1,016
  • 6
  • 10
17

The easiest way to do this for a headless setup is to create a file named ssh on the boot partition of the SD card. This will enable the SSH daemon immediately after first boot and will be deleted.

Official SSH guide: https://www.raspberrypi.org/documentation/remote-access/ssh/README.md#3-enable-ssh-on-a-headless-raspberry-pi-add-file-to-sd-card-on-another-machine

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

psyFi
  • 103
  • 2
88weighed
  • 915
  • 6
  • 17
2

Issue the two command as superuser

systemctl enable ssh.service
systemctl start ssh.service