I have just tested with a fresh flashed Raspbian Stretch Lite 2018-04-18 on a Raspberry Pi 3B+. Adding an empty file /boot/ssh
will persistent enable the ssh server on the Raspberry Pi. Even after several boots I get (have a serial tty-usb console cable):
pi@raspberrypi:~$ systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-04-18 01:08:39 UTC; 1 months 0 days ago
Process: 524 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 527 (sshd)
CGroup: /system.slice/ssh.service
└─527 /usr/sbin/sshd -D
Apr 18 01:08:39 raspberrypi systemd[1]: Starting OpenBSD Secure Shell server...
Apr 18 01:08:39 raspberrypi sshd[527]: Server listening on 0.0.0.0 port 22.
Apr 18 01:08:39 raspberrypi sshd[527]: Server listening on :: port 22.
Apr 18 01:08:39 raspberrypi systemd[1]: Started OpenBSD Secure Shell server.
pi@raspberrypi:~$
To enable wifi you have to add /boot/wpa_supplicant.conf
on your raspi with something like:
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="[email protected]"
psk="verySecretPassword"
}
You don't use a pi-3b+
but for the completeness for other readers: Adding the country=XX
line is essential for Pi 3 B+ because without it wifi will not start. Look at release notes:
018-03-13:
* Raspberry Pi 3 B+ support
* WiFi is disabled until wireless regulatory domain is set (Pi 3 B+ only)
- The domain can be done through 'Raspberry Pi Configuration' (rc_gui),
'raspi-config' or by setting 'country=' to an appropriate ISO 3166
alpha2 country code in /etc/wpa_supplicant/wpa_supplicant.conf.
* Default wireless regulatory domain is now unset
Putting it all together I have done this:
pc ~$ # on a pc with debian and mounted SD card to /dev/sdb
pc ~$ sudo -Es
pc ~# unzip -p 2018-04-18-raspbian-stretch-lite.zip | dd of=/dev/sdb bs=4M conv=fsync
pc ~# mount /dev/sdb1 /mnt/
pc ~# touch /mnt/ssh
pc ~# cat >/mnt/wpa_supplicant.conf <<EOF # use your settings
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="[email protected]"
psk="verySecretPassword"
}
EOF
pc ~# umount /mnt/
pc ~# exit
pc ~$
Put the SD card into your raspi and boot. If you do exactly the same as above you should be able to ssh into your raspi through wifi. If not the raspi isn't the reason (or it's broken). Look at your environment. Or you have done wrong settings.
wpa_supplicant.conf
to it and also give us the output fromssh -vv pi@>ip addr<
country=GB
(replace it with your country code) into yourwpa_supplicant.conf
on SD card in addition to the network SSID and password setup. You don't necessary to log in using IP address, if everything working, you can just log in usingssh [email protected]
.I believe the problem in this latest distribution is that placing ssh into boot doesn't enable ssh anymore
- the thing is/boot/ssh
is removed on boot - however, ssh is enabled - if there's a reboot, and you do not configure ssh to be enabled, the next boot results in ssh being not available. One thing a pi does on first boot is extend the root partition ... and then reboot - so, perhaps you simply need to put/boot/ssh
back on the sd card/boot/ssh
- which you know - but it is temporary (until the next boot) unless you enable it "permanently" (using raspi-config is the easiest way) - and I'm fairly sure the first boot of a raspbian image results in at least one reboot