Connect to a WPA2-Enterprise Connection via CLI (no desktop)

Solution 1:

You can use nmcli

# nmcli con add type wifi ifname wlan0 con-name CONNECTION_NAME ssid SSID
# nmcli con edit id CONNECTION_NAME
nmcli> set ipv4.method auto
nmcli> set 802-1x.eap peap
nmcli> set 802-1x.phase2-auth mschapv2
nmcli> set 802-1x.identity USERNAME
nmcli> save
nmcli> activate

You may also need to add

  • nmcli> set 802-1x.password PASSWORD
  • nmcli> set 802-1x.anonymous-identity ANONYMOUS-IDENTITY
  • nmcli> set wifi-sec.key-mgmt wpa-eap

Solution 2:

wpa_supplicant is the answer. It supports WPA-Enterprise and several EAP methods. I connect to my home network by executing:

wpa_supplicant -i wlan0 -B -c /path/to/wpa_supplicant.conf

Here is an example of configuration file. It's all about configuring this file to match your connection.