I want to add network block into /etc/wpa_supplicant/wpa_suppplicant.conf file.
The original file looks like,
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="HOMEWIFI"
psk="12345678"
}
and I would like to add new network block in command line, finally the file would be :
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="HOMEWIFI"
psk="12345678"
}
network={
ssid="NEW_WIFI"
psk="00000000"
}
I want to do this not manual, but command line.
I red https://wiki.archlinux.org/index.php/WPA_supplicant this, so If I run this
# wpa_supplicant -B -i interface -c /etc/wpa_supplicant/wpa_supplicant.conf
# wpa_cli
> scan
OK
> scan_results
> add_network
0
> set_network 0 ssid "NEW_WIFI"
> set_network 0 psk "0000000"
> enable_network 0
CTRL-EVENT-CONNECTED - Connection completed.
> save_config
OK
will add new network block successfully.
But I believe there is more easy and simple way. That above way takes time, and looks verbose. Is there more elegant and simple way to do it?