2

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)

5
  • 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
    Commented May 18, 2019 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
    Commented May 18, 2019 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
    Commented May 18, 2019 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
    Commented May 19, 2019 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 Commented May 19, 2019 at 0:59

1 Answer 1

3

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.

3
  • @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
    Commented May 19, 2019 at 1:16
  • Thank you for your answer. I retried, and it worked indeed, I probably had something else non-working before.
    – Basj
    Commented May 19, 2019 at 9:24
  • I just had this issue too on the first boot. A friend told me the ssh file gets wiped on first boot, so if you're following something that says "put ssh on there" it probably gets removed first time and you have to put it back on the card the second time
    – ntgCleaner
    Commented Mar 24, 2020 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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