How do I detect and connect to a hidden SSID on my Raspiberry Pi 3 (Raspbian)?

Kylecrocodyle picture Kylecrocodyle · May 19, 2016 · Viewed 57.9k times · Source

How do I configure my Raspberry Pi 3 (running Raspbian) to connect to a hidden network? I know it involves editing the /etc/network/interfaces file and the wpa_supplicant.conf file. I've followed a few other guides, but when I make these file changes and reboot, I can't even detect visible networks, as they disappear from my wifi menu. I think I'm just editing these files with incorrect configurations.

Answer

Kylecrocodyle picture Kylecrocodyle · May 19, 2016

First, enter the following in the terminal:

sudo nano /etc/network/interfaces  

Edit the interfaces file to look like so, which shouldn't be too different from the default:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Next, we will edit the wpa_supplicant.conf file. Enter the following in the terminal:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Edit the settings of this configuration file to be as such:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1 
network={
        scan_ssid=1
        ssid="Your Hidden SSID"
        psk="Your SSID's Password"
        key_mgmt=WPA-PSK }

Note: You will need to change the "country" setting based on your location. Also, scan_ssid must be set to 1 to be able to detect a hidden SSID. Input your SSID name and password for your hidden network. Save these changes, reboot your raspberry pi, and then it should be automatically connected to the hidden network upon returning to the desktop.