headless raspberry pi setup code example
Example 1: raspberry pi set wifi headless
crate a file in the root folder of the sd card ("boot") called
wpa_supplicant.conf
===========contents of file:=================
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>
network={
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
}
Example 2: enable ssh raspberry pi without monitor
How to enable SSH on a Raspberry Pi, without monitor:
1. Plug the Raspberry Pi SD-card into a SD-reader and connect it to a PC.
2. In the root-folder of the SD, create a file named "ssh" (without extention).
3. Plug it back in the Raspberry Pi and turn it on. SSH will start automatically.
Pro tip: If you don't know the IP address, use its hostname. Example:
ping raspberrypi.local
Example 3: raspberry pi headless
create a file in the root folder of the sd card ("boot") called
wpa_supplicant.conf
add scan_ssid=1 if connecting to hidden network
===========contents of file:=================
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>
network={
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
}