This command will add your network parameters to the configuration file of wpa_supplicant
sudo -s
wpa_passphrase YOUR_SSID YOUR_PASSWORD >> /etc/wpa_supplicant/wpa_supplicant.conf
If the SSID of the network is hidden additional step need to be done:
sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
Update what you just added scan_ssid=1
in your network parameters, such as from
network={
ssid="YOUR_SSID"
#psk="YOUR_PASSWORD"
psk=YOUR_PREKEY
}
to
network={
ssid="YOUR_SSID"
scan_ssid=1
#psk="YOUR_PASSWORD"
psk=YOUR_PREKEY
}
Thanks to https://www.raspberrypi.org/forums/viewtopic.php?t=25104