How to export the current wpa_cli network to a file?

9,370

You should add update_config=1 to your configuration file , it will give the rights to update it.

there is an example :

edit the /etc/wpa_supplicant/wpa_supplicant_example.conf , add the following lines:

ctrl_interface=/run/wpa_supplicant
update_config=1

Run wpa_passphrase command to export your configuration to wpa_supplicant_example.conf

wpa_passphrase Your_ssid Your_passphrase >> /etc/wpa_supplicant/wpa_supplicant_example.conf

Save then connect through wpa_cli.

Share:
9,370

Related videos on Youtube

wqh29974.dsiay.com
Author by

wqh29974.dsiay.com

Updated on September 18, 2022

Comments

  • wqh29974.dsiay.com
    wqh29974.dsiay.com over 1 year

    Say I have connected with wpa_cli to a network mynetwork:

    # wpa_cli 
    >add_network
    >set_network 0 ssid "mynetwork"
    >set_network 0 psk "SupahSecretPassphrase"
    >enable_network 0
    >reconnect
    

    How to export this network to a wpa_supplicant configuration file, that is a file containing:

    network={
                   ssid="mynetwork"
                   psk="SupahSecretPassphrase"
              }
    

    If there is no standard way, I guess I would have to recall ~/.wpa_cli_history


    PS:

    I tried save_config but I always have a FAIL result:

    >  save_config
    FAIL
    
  • another
    another about 6 years
    Honestly I still get the FAIL error when trying to save_config, following these steps didn't work to me.
  • GAD3R
    GAD3R about 6 years
    @roizpi Did you have NetworkManger installed? Did you have a wired connection available to reinstall it later if something went wrong ? If YES remove it.
  • another
    another about 6 years
    I haven't networkmanager installed. I have the wired connection yes, and wlan1 seems to have access point associated, but when disconecting the wire, I can't find any host associated with that machine.
  • GAD3R
    GAD3R about 6 years
    @roizpi Check the status wpa_cli status disconnect wpa_cli disconnect then try to reconnect. Remove the RJ45 first.
  • another
    another about 6 years
    I made the network work by using your steps, and making a proper configuration of /etc/network/interfaces. Thank you.