By default, SSH access is disabled on a RaspberryPi. If you start a fresh Raspberry Pi for the first time or have reinstalled the operating system, you will not be able to log in via SSH at first.
In order to activate this, you would first have to log in to the RaspberryPi locally - i.e. using a plugged-in keyboard, mouse and screen - and activate SSH manually.
In this (local) way you would also enter the login details to connect your RaspberryPi to your own WiFi.
Depending on how well you hide your USB keyboard/screen/mouse or generally have it available, this can be tiring.
In the following article I will explain how you can activate SSH and store your WiFi login details in the RaspberryPi without having to log in locally.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
Before you can configure the WiFi and activate the SSH server, you should have prepared the SD card for your RaspberryPI.
The following article describes what needs to be done:
RaspberryPi – setup for nerdiys!
Required material:
In the following list you will find all the parts you need to implement this article.
Open boot partition


Enable SSH server
To activate the SSH server on your RaspberryPI before the first boot process, you must create an empty file with the name "ssh" in this boot drive.




Save WiFi configuration
In order to set the WiFi configuration (i.e. SSID and WiFi password) before the first start, you need to create a text file in your boot drive with the name:
wpa_supplicant.conf
create.




# File wpa_supplicant.conf in the boot partition (Raspbian Stretch) country=DE ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="SSID_EURES_WIFIS" psk="PASSWORT_EURES_WIFIS" key_mgmt=WPA- PSK }

Configuring multiple networks with Raspian Jessie
# File wpa_supplicant.conf in the boot partition (Raspbian Jessie) country=DE ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="NetworkName1" psk="NetworkName1_PASSWORD" id_str="RandomConfigurableIdOfThisNetwork " } network={ ssid="NetworkName1" psk="NetworkName1_PASSWORD" id_str="RandomConfigurableIdOfTheSecondNetwork" }
Insert the SD card into your RaspberryPi
After you have entered these configurations you can reinsert the SD card into your RapsberryPI. The next time you boot, the configurations will be automatically applied and activated.
The RaspberryPi should connect to the set WiFi and also be accessible via SSH.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂