Forget WiFi Network On Raspberry

This how to helps you to learn how you enforce your Raspberry Pi to forget a known WiFi Network. As you can imagine, it’s quite simple, but as usual there are a couple of aspects that you need to know. Mainly, in which file the WiFi data is stored and how to delete this information. 

Forget WiFi Network On Raspberry

Forget WiFi Network On Raspberry

Index Of How To Forget WiFi Network on Raspberry

Background

For whatever reason, you maybe like your Raspberry Pi to forget a particular WiFi network. This How To Forget WiFi Network on Raspberry helps you to enforce your Raspberry “forgetting” the unwanted WiFi Network. 

The environment used for this HowTo:

  • Raspberry Pi 4 Model B
  • Raspbian GNU/Linux 11 (bullseye), Release 11 (This is similar to Debian Linux)

Of How To Forget WiFi Network on Raspberry

The good news is, that all WiFi information is stored in one file! That means, we only need to edit this file and delete the WiFi network that we would like the Raspberry to forget. This file is called “wpa_supplicant.conf” and its stored in “/etc/wpa_supplicant/”.

Lets kill the WiFi network that we do not like:

sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

This command opens the file in which all the WiFi information needed to connect a WiFi is stored. Now, it’s getting honestly very simple. Simply delete the WiFi that you do not like your Raspberry to connect to. A network your Raspberry can connect to looks for example like this:

network={
    ssid="49ers Network"
    psk="MyLAKing$49er$Pa$$word2connect!"
    key_mgmt=WPA-PSK
}
network={
    ssid="Zurich Football Club"
    psk="MyZur!chF00tball!Club!W!F!"
    key_mgmt=WPA-PSK
}

Delete the WiFi Network

So, if I would like to delete a WiFi network (as an alternative disable it, please check the Disable the WiFi Network chapter), then we need simply to delete the relevant networks. For example, if we would like to kill in the above the 49ers WiFi Network, but we would like only to keep the Zurich Football Club WiFi, then we simply delete the following lines:

network={
    ssid="49ers Network"
    psk="MyLAKing$49er$Pa$$word2connect!"
    key_mgmt=WPA-PSK

Btw. In case you get the opportunity to travel Europe, then I strongly recommend to watch a game of Zurich Football Club, as it is amazing what these fans do. 

After you deleted the 49ers Network, the file “sudo vi /etc/wpa_supplicant/wpa_supplicant.conf” in this example should look like this:

network={
    ssid="Zurich Football Club"
    psk="MyZur!chF00tball!Club!W!F!"
    key_mgmt=WPA-PSK
}

Instead of deleting the network, you also could disable it. To do so, go to the next chapter: Disable the WiFi Network chapter 

Disable the WiFi Network

Disabling is actually very simple. We assume in this scenario exactly the same sample as in the above. The aim is to simply disable the 49ers network. To do so we leverage on “#” that we simple set in front of the related confirmation. Once done, it should look like this:

# network={
#     ssid="49ers Network"
#     psk="MyLAKing$49er$Pa$$word2connect!"
#     key_mgmt=WPA-PSK
#}
network={
    ssid="Zurich Football Club"
    psk="MyZur!chF00tball!Club!W!F!"
    key_mgmt=WPA-PSK
}

As you can see, we simply have put the “#” in front of all network configuration that relate to the 49ers network. The Raspi want be able anymore to login into this WiFi network.

Additional Information

Follow me

It would be amazing if you follow my myhowto.blog. To my blog is actually easy! You can leverage on

  • Click to follow me on Twitter
  • Bookmark this page and comeback from time to time

Help and Comments

I am really looking forward for you to contact me if for example you found a better option or other idea then in this how to. Also, please touch base if you found an error or anything not working or if you have something that you would love to be added to the myhowto.blog. Simply click this link to touch base with me.

Linking Or Recommending The How To Or The myhowto.blog

I would love to see you are recommending this how to or link it to your website. Also, I would love if you link or recommend the whole myhowto.blog. Please feel free to do so! In case you like to touch base regarding this topic with me, then simply click this link. I look forward!