Configure WiFi connection in Raspbian Stretch Lite on Raspberry Pi

Raspberry Pi Quick Start Guide

Install and configure Raspbian on the Raspberry Pi
Configure WiFi connection in Raspbian Stretch Lite on Raspberry Pi
Share a folder from Raspberry Pi and access it from Windows
Mount a NAS share to Raspberry (Raspbian)


There are two ways to configure WiFi connection in Raspbian. Either using the Raspbian configuration tool “raspi-config” or setting the connection by command line.

Option 1: Configure WiFi connection by using “raspi-config”

Using raspi-config is the easier way for unexperienced users but there is also one big disadantage. Your WiFi password will be stored in the configuration file in clear text.

In the Raspberry Pi’s console enter:

sudo raspi-config
  • In the Raspberry Pi’s configuration tool enter “2 Network Options” -> “N2 Wi-fi
  • Enter your SSID (this is the name of your Wi-Fi)
  • Enter your WiFi password
  • Wait until you see the start screen of the configuration tool again and “Finish”. If you now want to know your IP adress enter “ifconfig” to the command line and you will see your IP next to “wlan0”:


Option 2: Configure WiFi connection by command line

To prevent saving the WiFi password in cleartext to the configuration file we can configure WiFi connection by using the command line. First enter the superuser mode and save the passphrase for the SSID into the configuration file:

sudo su
wpa_passphrase "SSID" "PASSWORD" >> /etc/wpa_supplicant/wpa_supplicant.conf

Now enter the configuration file with a text editor. You will see the following:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

        ssid="YOUR SSID"

Remove the line with the uncommented clear text password and press CTRL+X and answer the question for saving changes with “y

There is on final step missing that the system starts using this new configuration:

wpa_cli reconfigure

You have successfully connected your Raspberry Pi to your WiFi and can check your IP by enter:


Leave a Reply