21

I am using Raspbian. I would like to make programatic changes to the WiFi settings. However, I can't find where they are located. Where are they? Any tips for editing them?

Also, in the "Manage Networks" of the WiFi Config, I am not able to remove old connections. Has anyone else had this problem? Is there a better way to config WiFi on the Raspberry Pi than this program?

Scoop
  • 2,739
  • 7
  • 29
  • 25

4 Answers4

26

Default behavior seems to consist in storing wifi settings in /etc/wpa_supplicant/wpa_supplicant.conf, just like @lucaslink mentionned. I'd like to provide a bit more details however. Here is how the wpa_supplicant.conf file is supposed to look like:

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/Var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="MyWiFi"
        psk="MyPassword"
        key_mgmt=WPA-PSK
}

I just removed the lines related to my WiFi, leaving the network section empty:

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/Var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
}

And then I restarted the networking service:

sudo service networking restart
Anto
  • 361
  • 1
  • 3
  • 4
11

If you are talking about NetworkManager settings, they are in:

/etc/NetworkManager/system-connections

If you do a ls -l you will see all your wireless networks there, one file per network.

If you want to delete a connection, you simply need to delete the corresponding file. If you give a sudo cat YourNetworkName.conf you will see something like this:

[connection]
id=YourNetworkName
uuid=929ceffc-8191-4dea-9a61-b4b174b9c910
type=802-11-wireless
timestamp=1218126248

[802-11-wireless]
ssid=YourNetworkName
mode=infrastructure
mac-address=00:28:F7:21:B1:19
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
psk=yourpasswordgoeshere

[ipv4]
method=manual
dns=192.168.10.1;8.8.8.8;
addresses1=192.168.10.100;24;192.168.10.1;

[ipv6]
method=auto

Everything is easily editable, provided that you know what these parameters mean.

For what concerns your last question:

Is there a better way to config WiFi on the Raspberry Pi than this program?

if you need a more reliable (and maybe scriptable) WPA/WPA2 connection I suggest to use WPA_Supplicant (or HostAP if you want your Raspberry Pi to become a wireless router) directly. I have to admit that NetworkManager is somehow practical, but it tends to take initiative too often for my taste, so I never use it when I need reliability.

Avio
  • 1,239
  • 2
  • 15
  • 27
5

I had the same issue, where WifiConfig GUI would not remember the deletion/removal of ssids in the Manage Networks tab. Raspbian doesn't have 'NetworkManager' settings but instead holds all network information (ssids, passwords, etc.) in

/etc/wpa_supplicant/wpa_supplicant.conf

to edit:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

it's contents will look something like:

network={
ssid="network name"
psk="wifi password"
}

Once the file has been edited and saved reboot your pi for changes to take effect. Your pi will no longer attempt connection to the forgotten networks.

IF this file is empty, but your raspberrypi is still connecting to rogue networks, your credentials are likely held in the interfaces file:

sudo nano /etc/network/interfaces

The entries for ssids and networks looks a little bit different in here, but same idea. You should see them at the end of the file. They will look something like:

wpa-ssid "network name"
wpa-psk "wifi password"

Delete/Add as you see fit.

lucaslink
  • 51
  • 1
  • 1
0

I had this similar question some eleven years later. In my case, I have many similar devices and I want to automate cloning one to the next using the SD Card Copier utility provided with Raspberry pi O/S. I have two wifi devices, one internal and one an external usb plugin device. I found two files in /etc/NetworkManager/system-connections for the local SSID. The difference between the two files, other than the uuid value in the [Connections] section, is the mac-address value in the [wifi] section. These values will be wrong for the cloned device. To address this, I have a script to get the correct mac addresses using "ip -brief link show dev [wlan0|wlan1]", then I use sed on each file to replace the mac-address value.