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.
-
1Have you tested that the ssh server is not now always started after a reboot?– GramThanosJun 24, 2019 at 0:55
-
@GramThanos: What I meant was that the file no longer exists after a reboot.– user105131Jun 24, 2019 at 1:07
-
I know, it is normal.– GramThanosJun 24, 2019 at 1:18
2 Answers
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?– user105131Jun 24, 2019 at 1:32
-
-
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?– user105131Jun 24, 2019 at 1:42
-
1Yes. 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. Jun 24, 2019 at 1:47
-
So you may now, change the default pi password and set a static ip to your raspberry (if you want) :P Jun 24, 2019 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.– user105131Jun 24, 2019 at 3:43
-
1