13

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?

4

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.

  • Now, with Raspbian Jessie, you most definitely want to use wpa_supplicant. There are some odd initial issues, such as the OS swapping wlan0 and wlan1 - but once it is stable it is pretty reliable now. – SDsolar Sep 30 '17 at 4:19
  • i can't find /etc/NetworkManager ? – mrid Jul 10 '18 at 5:43
  • Do you have NetworkManager currently installed? What distro are you running? Both Ubuntu 16.04 and Debian/Raspbian Jessie have network-manager among their packages. You can install it with sudo apt install network-manager. – Avio Jul 10 '18 at 12:44
17

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
  • 1
    Still true in September 2017 with Raspbian Jessie. – SDsolar Sep 30 '17 at 4:16
4

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.

  • How exactly should I edit wpa_supplicant.conf? Do I delete everything or just the network node or just what's between the curly brackets? – Hand-E-Food Jul 13 '16 at 14:07
  • 1
    @Hand-E-Food Best case is to just remove whats between the curly brackets then restart the networking service: sudo service networking restart @Anto's answer below covers this too. Good luck! – lucaslink Jul 14 '16 at 14:39
  • In wpa_supplicant.conf you can remove the networks you want it to forget and leave the ones you think you want, with the SSID and password. It will connect to the first one that works. In my Raspian I haven't seen the wireless connections in interfaces by address. In there it says dhcp. – SDsolar Dec 2 '16 at 6:07
  • You can use your favorite editor, such as vi to edit the file, but of course you need to use sudo vi – SDsolar Sep 30 '17 at 4:21

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.