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.
The Secret Sauce Steps
0. 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)
4. Edit your interfaces file to look like this:
5. Save the interfaces file.
Edit wpa_supplicant
1. cd /etc/wpa_supplicant
2. sudo cp wpa_supplicant.conf wpa_supplicant.conf.orig
3. sudo vi wpa_supplicant.conf
4. Edit your wpa_supplicant file to look like this:
5. 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:
Test
- 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!
Keep coding,
Mark
Related Posts:
Tags: hidden, interfaces, Raspberry Pi, SSID, wifi, wpa_supplicant
Thanks heaps, this helped me connect my Pi to the hidden ssid of my network.
Glad it helped, Chris!
Take care,
Mark
THANK YOU – THANK YOU – THANK YOU!!
I tried other “proposed solutions” for private SSID with no success. On first-try with yours … BOOM … wifi working!
Thanks for sharing!
TG
That was my frustration, too. Glad it helped!
perfect. thanks so much!
Very welcome, Jon! Glad you found it useful. 🙂
Hello,
I followed your guide but my Raspberry Pi 2 will still not pull an IP when I am not broadcasting. If I turn on broadcasting, then it works fine. Any ideas?
I am updated/upgraded and I am using the Wi-Pi adapter.
I tried this twice and it is not working for me on my raspberry pi 2. When I run ifconfig -a, wlan0 says:
Link encap: Ethernet…
I only see an inet6 addr. The info next to the packets all say 0. Please help.
Hi Michael,
I’m not familiar with that wifi adapter. Is it on the Raspberry Pi Foundation’s tested/recommended adapter list? If not, I’d strongly encourage you to get one that is, as it can save you hours of frustration. If it is on the list, you may want to post a question on the forums at raspberrypi.org. Sorry I can’t help you more, but these instructions have always worked for me using Edimax and Adafruit adapters. Best of luck!
Cheers,
Mark
Hi J,
Please verify first that your wifi adapter is on the Raspberry Pi Foundation’s tested/recommended adapter list. If not, I’d encourage you to get one that is, as various others don’t always play well with the Pi…even when they say they do. If yours is on the list, you may want to post a question on the forums at raspberrypi.org. I wish I could help you more, but these instructions have always worked for me using Edimax and Adafruit adapters. Best of luck to you!
Cheers,
Mark
Thank you for this article. The Raspberry Pi can connect successfully to a hidden network at boot, but if the network is not available until after the Raspberry Pi has started, or the router has restarted the Pi does not connect. How can I configure the Pi to automatically connect to the hidden network whenever it is available? Thank you in advance!
Worked perfectly for me. Thanks!
Thank you for sharing this. It worked for me as well. A+ 🙂
[…] buscar la manera de hacerlo, y encontré este artículo que lo explica detalladamente. Vamos a […]
it wont let me edit interfaces… Im gonna cry.
Dude! I wish I found this 3 hours ago (that’s how long I’ve been fuzting with settings for wi-fi). Thanks for the clear guide! You also get extra points for taking a backup of each edited file, as sadly, most guides I’ve found today don’t do that – which makes the SysAdmin in me want to scream. 🙂 Thanks again for the tip!
Thanks Craig, glad you found it useful! I always try to leave myself an escape hatch, just in case. Not that I’ve ever needed it, of course. 😉
Cheers!
Mark
Works great! Thank you!
Linux raspberrypi 4.1.18-v7+ #846 SMP Thu Feb 25 14:22:53 GMT 2016 armv7l GNU/Linux
Very welcome, glad it helped!
Cheers,
Mark
Made an account just to say thank you. Thank you.
Thanks, this worked perfectly on my new Pi3 with its built-in WiFi.
Aloha, Tim
Hi Tim,
Glad to hear it! I haven’t tested this on the Pi3 yet, so this is definitely good to hear. Aloha!
Mark
You’re very welcome! Glad it helped. 🙂
Cheers,
Mark
Looked like it was worth a trying but after three attempts I am unable to get Rap Pi 3B+ (w/onboard wifi) to be able to connect to my hidden SSID. Not sure what vlse to try as so many here had success (with prior RaspPi).
having issues with my RPI3
getting the following for ifconfig:
eth0 Link encap:Ethernet HWaddr b8:27:eb:4b:d5:3d
inet addr:192.168.1.74 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2602:306:36c9:c70:f418:2844:6d64:aa6b/64 Scope:Global
inet6 addr: fe80::66b9:e804:a95e:8576/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1176 errors:0 dropped:0 overruns:0 frame:0
TX packets:894 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67242 (65.6 KiB) TX bytes:114669 (111.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
On a RPI3 with the latest image (jessie may 2016) you dont need to edit the /etc/network/interfaces. The defaults in this version is fine.
Just do add the settings above in the wpa_supplicants.conf and the hidden wlan in working fine. Very easy!
Thanks for the update!
Cheers,
Mark
I wasn’t able to edit the files, they would show but wouldn’t let me edit it
Hi Hamish,
Note that you have to have superuser privs to edit+save these files. The easiest way is to preface your editor commands with sudo, e.g. sudo vi /path_of_file_to_edit/name_of_file_to_edit, which you can think of as “Super User Do”. That gives you “the power”. 🙂
Hope this helps,
Mark
Dude, thank you so much. To all those people who think it is stupid to hide a network because it does not additional security. Well P!SS OFF!
If a burglar cannot find a window on your home because you hid them then it makes it more difficult to enter the home with out heavier equipment.
Very welcome, glad it helped!
Hi Mark,
I could notable to see the images of the configuration file. Can you please help me with the document. If feasible can you please email me.
Thanks in advance
Raj
I fixed the links. Thanks for the heads-up Raj, you should be able to see them again now. 🙂
Cheers,
Mark
I am having the exact same problem as Brian Tucker with getting my RPI3 to connect to my hidden wifi.
Images aren’t displaying. I cannot read your configs.
Hi Kenneth,
They were offline briefly while I changed my GH ID, but they’re online & visible now (just confirmed!). Please retry, and if they still don’t appear for you, you may want to verify you don’t have a plugin enabled in your browser that is interfering with the code samples being displayed, pulled from a third site (GitHub).
HTH,
Mark
Brilliant! Thank you!
Very welcome! 😀
Cheers,
Mark
Everything works fine but the weird thing is that none of the devices on my network except router is visible…. It says host unreachable.. Any solution, please?
You can get the entire solution working with 1 step. Simply modify /etc/wpa_supplicant/wpa_supplicant.conf and add the following 4 lines to the bottom (then save and restart):
network={
ssid=“REPLACE_WITH_SSID”
psk=“REPLACE_WITH_PASS”
scan_ssid=1
}
[…] The first issue I faced was how to connect my Raspberry Pi to my hidden wifi network. To solve it, I found this site useful. […]
I echo the thanks of all the previous replies. Works a treat. Connected first time.
Very welcome, glad it helped!
I tried you instructions on my rPi3 and it threw some error. Later, I came across an article that showed how you connected to hidden networks:
1) Make your network non-hidden.
2) Connect your Pi to your network.
3) Make your network hidden again.
4) Go to terminal and type in the following commands..
4i) cd /etc/wpa_supplicant
4ii) sudo leafpad wpa_supplicant.conf
5) Now, you’ll find yourself facing the conf file and you’ll be able to see your network and password.
6) Add “scan_ssid=1” to the list which has your network.
This only works for Pi 3, you’ll have to follow the above instructions for older versions.
[…] I googled “connect to hidden SSID on raspberry pi” and came up with a nice blog page with a procedure in. I tried it on my Pi3 with Jessie (a few months old) but it didn’t work for me (it was a bit […]