Setting up Wifi by Hand (Advanced)

We recommend using raspi-config for easy setup (see previous page "Setting up WiFi"). The manual file manipulation is included here as it allows one to setup a "headless" Pi (no keyboard or monitor).

To configure Wifi you will need to edit the file /etc/wpa_supplicant/wpa_supplicant.conf. There are two ways to do this as described below. Use whichever is most convenient for your setup and situation.

With either approach, you'll want the contents of the file to be what is shown below. Replace YOURSSID and YOURPASSWORD with whatever is used for your network setup.

Download: file
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
Don't put any spaces around the = in this file. It doesn't like that.

Create the file in /boot

This approach will allow you to configure Wifi by creating and editing the file directly on the SD card in another PC. The /boot partition is FAT formatted which is readable by most PC's. So you can simply insert the SD card in a USB reader and a boot folder should show up.

If you create a wpa_supplicant.conf file in /boot, it will be copied to the main partition's /etc/wpa_supplicant location at boot time,replacing whatever is there. It will then be deleted from /boot, so you won't see it there if you go looking.

So just use whatever text editor (not word processor) you want on your PC to create the file in /boot, like this:

Save the file and safely remove the SD card from your PC. Put it in the Raspberry Pi and power it up. If all goes well, it should copy the file over and connect to your Wifi.

Edit the file in /etc/wpa_supplicant

This is the more direct approach - you edit the file directly on the Raspberry Pi. This approach works good if you are already connected to the Raspberry Pi via a console cable or monitor.

Since this file requires elevated privileges to access, you'll need to open it with sudo.

Then add the contents. Don't forget to actually change YOURSSID and YOURPASSWORD.

Press CTRL-X and then Y to save and and exit. Then run the following command to have the file read and try to connect to your Wifi.

Download: file
sudo wpa_cli -i wlan0 reconfigure
This guide was first published on Dec 10, 2012. It was last updated on 2019-05-15 10:21:32 -0400. This page (Setting up Wifi by Hand (Advanced)) was last updated on May 22, 2019.