1

SSH is disabled by default for security, which is annoying for a headless RPi. The usual trick was to create an empty ssh file in /boot/ which was possible even from Windows, because the boot partition is visible.

Now (I tried with Raspbian Stretch Lite) it doesn't seem to work anymore, and this is confirmed by this comment here:

I tried the headless setup on Raspbian Stretch Desktop from 2018-03-14 and it doesn't seem to be working anymore, was working with previous versions. – JBaczuk Apr 3 '18 at 18:36

and also here:

Does NOT work on November raspbian stretch – decades Jan 25 '18 at 15:18

How to do it today? (I'm looking for a solution working from Windows)

  • Why do you think it doesn't work? Why do you want to do it again? Most of my Raspbian images are 2017-08-16 and a few 2018-11-13 with the smaller OS - there is no need to keep loading new images. Incidentally you don't put the file in /boot BUT in the first partition on the SD Card. – Milliways May 18 at 23:27
  • Why do you want to do it again? I don't understand your question. This feature (boot partition's ssh file to enable SSH) should work no matter the age of the image, and it should work on a freshly installed Raspbian... Also I don't understand the close vote reason... – Basj May 18 at 23:43
  • Once you have enabled ssh there is no reason to do it again. Any question which claims "it doesn't work" without evidence is unclear and unanswerable – Milliways May 18 at 23:46
  • Again the question: why do you think it doesn't work? Do you checked it on the RasPi with systemctl status ssh? Please address me with @Ingo, otherwise I won't see your answer. – Ingo May 19 at 0:07
  • This feature should work no matter the age of the image - not really, the "feature" didn't exist in the very first image, it was introduced "as of the November 2016 release" - those numpties in the two "examples" you gave just don't know what they are doing or are using older images – Jaromanda X May 19 at 0:59
2

I've tested this today with the current image (image dated 2019-04-08), and it does indeed still work.

The file should be named either "ssh" or "ssh.txt", and put in the (first) partition which shows up as named "boot" - but not in a subfolder within this. If you see kernel7.img and cmdline.txt you're in the right place - it goes along-side those, and nowhere else.

Some troubleshooting tips:

  • If the file is correctly parsed, it will also disappear from /boot. If it's disappearing and you still can't reach ssh, the most probable issue is that you're not finding the correct IP for it.
  • Verify the card is actually booting correctly (this can take several minutes on the first boot). hdmi would be easiest. Another clue would be a distinct lack of activity from the green LED. If you load the card in your preferred partition editor, you should see almost no free space after the second partition (the partition is expanded on the first boot. If it hasn't been expanded, either the sd card is faulty or the image wasn't written correctly.)

To directly answer the question, the feature still exists as documented. If you want to verify for yourself, you can find it implemented in /lib/systemd/system/sshswitch.service.

  • @JaromandaX oh man, how embarrassing. I got hung up on most people not knowing about the .txt trick, and totally missed that goof. Thanks! – Shaun May 19 at 1:16
  • Thank you for your answer. I retried, and it worked indeed, I probably had something else non-working before. – Basj May 19 at 9:24

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.