Skip to content

Instantly share code, notes, and snippets.

@kaangiray26
Last active January 21, 2024 16:48
Show Gist options
  • Save kaangiray26/4be8a2fa1e880315eb335090b78ee71c to your computer and use it in GitHub Desktop.
Save kaangiray26/4be8a2fa1e880315eb335090b78ee71c to your computer and use it in GitHub Desktop.
Connecting to a PEAP Wi-Fi Network via nmcli

Here's an example one line command to add a wifi network:

nmcli con add type wifi ifname wlan0 con-name "<con-name>" mode "infrastructure" wifi.ssid "<ssid>" wifi-sec.auth-alg open wifi-sec.key-mgmt wpa-eap 802-1x.domain-suffix-match "<domain>" 802-1x.eap peap 802-1x.identity "<identity>" 802-1x.password "<password>" 802-1x.phase2-auth mschapv2

Or just use the following shell script after you change the credentials:

#!/bin/bash
name="connection_name"
ssid="network"
domain="example.com"
identity="[email protected]"
password="123"

nmcli con add type wifi ifname wlan0 con-name "$name" mode "infrastructure" wifi.ssid "$ssid" wifi-sec.auth-alg open wifi-sec.key-mgmt wpa-eap 802-1x.domain-suffix-match "$domain" 802-1x.eap peap 802-1x.identity "$identity" 802-1x.password "$password" 802-1x.phase2-auth mschapv2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment