When I got my first Raspberry Pi Model B (not long after they first became available – remember when they only had 256M?!?), I wanted to configure it to use a wifi adapter. Even with approved, compliant adapters, this wasn’t for the faint of heart; many steps, scripts, and secret incantations were required to get everything to connect, even in the best of circumstances.
Fast-forward to today, when wifi adapter drivers are included in the base Raspbian build. It’s relatively simple to connect to wifi networks that broadcast their SSIDs. Ah, but what about those with hidden SSIDs? Not so much.
Many sites have documented ways to get around this. The problem is that I’ve tried several of them without success, so I always return to my original settings – and they still work just as well as the day I put them together. So to save myself (and hopefully you, if you’re reading this post!) a great deal of time in the future, here is the shortest path I’ve found to configuring your Raspbian-running Pi to connect to a wifi network that doesn’t broadcast its SSID.
- Log into your Pi (default user ID: pi, default password: raspberry).
Edit the network interfaces file
1.* cd /etc/network*
2.* sudo cp interfaces interfaces.orig* (this makes a backup copy of your interfaces file)
3.* sudo vi interfaces* (feel free to use a different editor if vi isn’t your cup of tea)
Edit your interfaces file to look like this:
Save the interfaces file.
1.* cd /etc/wpa_supplicant*
2.* sudo cp wpa_supplicant.conf wpa_supplicant.conf.orig*
3.* sudo vi wpa_supplicant.conf*
Edit your wpa_supplicant file to look like this:
Save the wpa_supplicant.conf file.
NOTE: If you have another network entry in this file (e.g. for a guest network), be sure to place this line in its entry to prevent its use:
- sudo reboot
- Login once prompted.
- ifconfig -a
If it’s working properly, your wlan0 adapter will show a valid IP address, a number of bytes and packets received and sent (RX and TX), and several other useful bits of information.
That’s all, folks
I’ve used this with three different wifi adapters, and it’s worked every time. Hopefully, it will work for you as well.
If you found this useful (or not, clear or confusing, etc.), please let me know. Good luck, and enjoy your Pi!