Kali linux wpa_supplicant cli config

Kali linux wpa_supplicant cli config.

To setup a wifi connection using wpa_supplicant on the cli in kali, first you have to bring up your network interface

ifconfig wlan0 up

Next, we create a config file

wpa_passphrase 'router_ssid' 'wifi_password' > /etc/wpa_supplicant.conf

We need to edit the config file and remove some things

vim /etc/wpa_supplicant.conf

Change the config file so that it contains:

network={
    ssid="router_ssid"
    #psk="wifi_password"
    psk=long_hex_string_goes_here
}

Finally, we can auth with our router and obtain an ip address to access the network

sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
sudo dhclient wlan0

Command Line Options (taken from the wpa_supplicant man page)

Most command line options have global scope.
Some are given per interface, and are only valid if at least one -i option is specified, otherwise they are ignored. Option groups for different interfaces must be separated by -N option.

-b br_ifname Optional bridge interface name. (Per interface)
-B Run daemon in the background.
-c filename Path to configuration file. (Per interface)
-C ctrl_interface Path to ctrl_interface socket (Per interface. Only used if -c is not).
-i ifname Interface to listen on. Multiple instances of this option can be present, one per interface, separated by -N option (see below).
-d Increase debugging verbosity (-dd even more).
-D driver Driver to use (can be multiple drivers: nl80211,wext). (Per interface, see the available options below.)
-f output file Log output to specified file instead of stdout.
-g global ctrl_interface Path to global ctrl_interface socket. If specified, interface definitions may be omitted.
-K Include keys (passwords, etc.) in debug output.
-t Include timestamp in debug messages.
-h Help. Show a usage message.
-L Show license (GPL and BSD).
-p Driver parameters. (Per interface)
-P PID_file Path to PID file.
-q Decrease debugging verbosity (-qq even less).
-u Enabled DBus control interface. If enabled, interface definitions may be omitted.
-v Show version.
-W Wait for a control interface monitor before starting.
-N Start describing new interface.

Kali linux wpa_supplicant cli config sources: wpa_supplicant man page