pi-gen: Setting default WiFi settings

In Raspbian, the WiFi settings are found in /etc/wpa_supplicant/wpa_supplicant.conf. In my use case, all my RPis are in the same WiFi network, and it is easier for me to write that setting in the image.

Before writing the settings, we also need to get the pre-shared-key (psk) in hashed mode instead of storing it in the clear in the .conf file. To get the hashed psk, do the following at the command line:

wpa_passphrase [SSID] [wifi password]

for example:

wpa_passphrase MarvelWorld SpideyIsHome2017

which will return

network={
  ssid="MarvelWorld"
  #psk="SpideyIsHome2017"
  psk=8b2972afc8724ff207bac00980457759e49eb089223a151db142503994e72b9d
}

put this into stage2/02-net-tweaks/files/wpa_supplicant.conf:

country=SG
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
  ssid="MarvelWorld"
  #psk="SpideyIsHome2017"
  psk=8b2972afc8724ff207bac00980457759e49eb089223a151db142503994e72b9d
}

Note that I changed the country to SG. You should change it to where you are using the RPi.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s