krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan

[sudo] password for krishna: 

Selected interface 'wlan0'


krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli scan_results

Selected interface 'wlan0'

bssid / frequency / signal level / flags / ssid
fc:0a:81:1d:6d:80   2412    -43 [WPA2-PSK-CCMP][ESS]    econsys
00:24:01:ba:b4:65   2437    -72 [WPA-PSK-TKIP][WPA2-PSK-TKIP][WPS][ESS] Test
6c:72:20:f2:1a:6b   2412    -60 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]  Hari
c0:ee:fb:31:ec:4a   2447    -76 [WPA2-PSK-CCMP][ESS]    Vishal's hotspot
fc:0a:81:1c:6d:f0   2412    -61 [WPA2-PSK-CCMP][ESS]    econsys
c4:12:f5:08:10:70   2427    -63 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS]  GoGreen
f4:f2:6d:6d:23:44   2462    -62 [WPS][ESS]  joyglobal

krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli add_network

Selected interface 'wlan0'


krishna@krishna-PC:~/Downloads/wificonnect1$ sudo wpa_cli set_network 1 ssid "econsys"

Selected interface 'wlan0'

How should I connect?


Create a /etc/wpa_supplicant/wpa_supplicant.conf file with the following lines:



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





sample output:


select the SSID (replace 0 with the exact output):

set_network 0 ssid "Your SSID here"

Set your password :

set_network 0 psk "You Password here"

Without the double quotes the command will FAIL. Next step:

enable_network 0



Without the interactive commands you should use (single quote added):

sudo wpa_cli set_network 1 ssid '"econsys"'


sudo wpa_cli set_network 1 ssid "\"econsys\""

instead of:

sudo wpa_cli set_network 1 ssid "econsys"

The single quote should be added too when adding your password:

sudo wpa_cli set_network 1 psk '"Your Password"'
  • Still after following the steps, "save_config" returns FAIL.
    – another
    Feb 10 '18 at 18:59
  • 1
    Successfully initialized wpa_supplicant ctrl_iface exists and seems to be in use - cannot override it Delete '/run/wpa_supplicant/wlan1' manually if it is not used anymore Failed to initialize control interface '/run/wpa_supplicant'. You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before starting wpa_supplicant again.
    – another
    Feb 10 '18 at 19:24
  • @roizpi Run killall wpa_supplicant then try again.
    – GAD3R
    Feb 10 '18 at 19:25
  • I use the command, but still get same error trace
    – another
    Feb 10 '18 at 19:44
  • 1
    @another, can you let us know what was your issue? I run into the same error, and try to see what would be possible reason.
    – bizi
    Jun 4 '19 at 8:53

To add a new network, without interactive command,

And then,

sudo wpa_cli add_network

To set ssid and Password for the new network, eg: ssid: mynetwork , password: 123456789

For SSID,go to the hexa code

Type your ssid name and convert to HEX code (choose without space).

sudo wpa_cli add_network ssid 1 "6d796e6574776f726b"

For psk , go to PSK Generator and type ssid name in "SSID" and password in "Passphrase" column and click generate PSK. (This is secure , dont need to worry about giving credentials)

sudo wpa_cli add_network 1 psk "26eb897d8abf5fa4649b77736b03fd544161ee41c85066ee0a5b233ad3650bd3"

This is the only method will work when you try to set a network outside of interactive mode. Have tried giving credentials directly , always fails.

And if save_config fails, try this one

sudo wpa_cli reassociate 1
  • You can usewpa_passphrase "ssid" passphrase to generate the psk.
    – GAD3R
    Dec 16 '20 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.