To permanently enable ssh for a headless setup, my understanding is that the simplest method is to create an empty file /boot/ssh on the boot partition. However, when I write to a file using this pathname, the change doesn't persist after I reboot. If I'm understanding correctly, then this is because I'm not actually accessing the boot partition, and I need to mount that somehow. How do I do that? I'm running Raspbian on a pi-zero, installed from NOOBS.

  • 1
    Have you tested that the ssh server is not now always started after a reboot? – GramThanos Jun 24 '19 at 0:55
  • @GramThanos: What I meant was that the file no longer exists after a reboot. – Ben Crowell Jun 24 '19 at 1:07
  • I know, it is normal. – GramThanos Jun 24 '19 at 1:18

From the raspberry pi ssh documentation page (here)

When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted.

Don't forget to change the default password.

  • I see...so is the effect permanent, even though the file gets deleted? – Ben Crowell Jun 24 '19 at 1:32
  • The file is just an easy way to set the ssh server to auto start. – GramThanos Jun 24 '19 at 1:38
  • Thanks. What I'm trying to ask is, if I then reboot a second time, with the file no longer existing, will ssh still be enabled? – Ben Crowell Jun 24 '19 at 1:42
  • 1
    Yes. You created the ssh file inside the boot partition, the raspberry saw it and deleted it, it set the ssh service to start on boot, and now ssh server will start every time automatically. – GramThanos Jun 24 '19 at 1:47
  • So you may now, change the default pi password and set a static ip to your raspberry (if you want) :P – GramThanos Jun 24 '19 at 1:48

You NEED a keyboard and display to setup NOOBS so the solution to enable ssh on a headless system is superfluous.

This CANNOT be done on NOOBS, until Raspbian is installed (because the boot partition does not exist).

Just enable ssh through raspi-config (or the GUI equivalent).

  • I have a keyboard and display. I'm setting the pi up initially using them, so that I can run it headless later. – Ben Crowell Jun 24 '19 at 3:43
  • 1
    If you want to run headless DO NOT use NOOBS (which wastes 1.3GB of your SD Card) and is only useful for multi-boot. Install Raspbian! – Milliways Jun 24 '19 at 3:49

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.