Skip to content

Instantly share code, notes, and snippets.

@GabrielMMelo
Last active October 19, 2020 14:05
Show Gist options
  • Save GabrielMMelo/b0795542624a5b74a7729edd9a94f092 to your computer and use it in GitHub Desktop.
Save GabrielMMelo/b0795542624a5b74a7729edd9a94f092 to your computer and use it in GitHub Desktop.
Connect to WPA/WPA2 WiFi through Linux terminal

install requirements

sudo apt update
sudo apt install wpa_supplicant

get the interface name e check if it's up

iw dev
ip link show <interface-name>

if it's down, turn it up

sudo ip link set wlan0 up  

check its status

iw <interface-name> link

set ESSID and PSK

sudo wpa_passphrase <ESSID> >> /etc/wpa_supplicant.conf

after hit enter, the prompt will wait you to insert the network password. Just enter it and hit enter

check if there is any wpa_supplicant running. If so, kill it

sudo ps aux | grep wpa_supplicant
kill <PID>

run wpa_supplicant

sudo wpa_supplicant -B -D nl80211 -i <interface-name> -c /etc/wpa_supplicant.conf

check its status again

iw <interface-name> link

get its IP address

sudo dhclient <interface-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment