title: What's the purpose of the key_mgmt attribute within wpa_supplicant? Does it need to be explicitly define?
body: <p>I'm writing a bash script that is intended to update a Raspberry Pi's wifi settings contained with <code>/etc/wpa_supplicant/wpa_supplicant.conf</code> (running raspbian 9 stretch).</p>
  
  <p>As per the official Raspberry Pi <a href="https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md" rel="noreferrer">documentation</a>, I am making use of the <code>wpa_passphrase</code> command, in which I can input the ESSID and password of my desired network and then append it's output onto the end of the existing <code>/etc/wpa_supplicant/wpa_supplicant.conf</code> file, before reloading the settings with <code>wpa_cli -i wlan0 reconfigure</code>.</p>
  
  <p>This is all fine and dandy and works great, but I noticed that it doesn't produce any <code>key_mgmt</code> fields, unlike if you were to manually log into a network via the desktop GUI.</p>
  
  <p>I'm just curious if there is any harm in not having that <code>key_mgmt</code> field explicitly defined? What is its use case, if networks can be connected to without trouble without it (at least in my cases). I read through the sparse documentation for <code>wpa</code> and <code>wpa_supplicant</code>, and it didn't tell me much.</p>
  
  <p>For reference, the networks that I noticed would work with or without this field would have the <code>key_mgmt=WPA-PSK</code> if I logged in via the RPi's desktop GUI. All the networks I tested with had this in common.</p>
  
  <p>Thanks in advance!</p>