wpa_supplicant connect to wifi hotspot under linux system

 1 minute to read

wpa_supplicant is a very powerful wireless network card management program under linux system. WPA2 is an alias of RSN, and AES is also part of CCMP, so there is no problem with wpa_supplicant supporting them.

The wpa_supplication.conf configuration file is as follows:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
ap_scan=1
update_config=1
  
network={
    ssid="xxxx"
    scan_ssid=1
    psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}

ssid: wifi hotspot name

scan_ssid=1: If your wireless access point is hidden, then this is a must. Otherwise, you cannot connect to the wifi hotspot

psk=xx: is the encrypted password, automatically generated with wpa_passphrase

proto=RSN WPA2 encryption type select this

The wpa_passphrase command line program is used as follows:

$ wpa_passphrase
usage: wpa_passphrase <ssid> [passphrase]
  
If passphrase is left out, it will be read from stdin
$ wpa_passphrase TPLINK123 1234567890
 network={
         ssid="TPLINK123"
         #psk="1234567890"
         psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 }

sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

sudo dhcpcd wlan0