How to connect to WPA2-Enterprise wifi

Connecting to the university wifi is such a pain on Raspberry Pi 400 because the default settings were not right and it was impossible to select the right one in the UI. Please follow the following steps:

  1. In the UI, connect to the WIFI you want to connect to and enter your credentials.
  2. If it wouldn’t connect, use the following command:
cd /etc/NetworkManager/system-connections
sudo nano YOUR_SSID.nmconnection

Edit YOUR_SSID accordingly.

  1. Delete everything in the file, and put the following content into the file. Modify the bold fonts as highlighted below as needed. Then you should be able to connect.

[connection]
id=THE SSID THAT YOU WANT TO CONNECT TO
uuid=YOURS SHOULD BE UNIQUE AND LEAVE IT AS IS
type=802-11n-wireless
interface-name=wlan0

[802-11n-wireless-security]
auth-alg=open
key-mgmt=wpa-eap

[802-11n-wireless]
mode=infrastructure
ssid=utepsecure
security=802-11n-wireless-security

[802-1x]
eap=peap;
identity=YOUR ID HERE
password=YOUR PASSWORD HERE
phase2-auth=mschapv2
[ipv4]
method=auto

[ipv6]
method=auto