Headless install of Raspberry Pi to join a hidden wireless network
Problem
Configure a boot device for a Raspberry Pi so that it will connect to a wireless network name (SSID) that is hidden, or does not show with a name when scanned.
Solution
- Mount the boot partition
- Change directory to that mount point -
cd /run/media/username/boot
- Create an empty file so that the ssh daemon gets started -
touch ssh
- Create a file called
wpa_supplicant.conf
with the contents modeled around below - the key part for a hidden network isscan_ssid=1
as otherwise, it will not work, it will silently fail, it will not connect, and you will not be able to SSH to it to see why. Fail.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1country=GB
network={
ssid="HiddenSSIDhere"
scan_ssid=1
psk="SuperSecretPasswordHere"
}
Story
Its easy enough to get it to join a network and bring up ssh so you can connect to it and configure it - however it takes the extra step of scan_ssid=1
to get it to join a hidden network.
There are plenty of reasons you may wish to do this including having a separate network for your Internet of Shit - where devices cannot speak to each other, and isnt visible to the rest of the world (well - ofcourse its THERE otherwise you would not be able to conenct - but there is no SSID name published alongside the available network).
This setting means that you know the name, you then scan to see which unnamed networks match - you join it. Good times.