How to prevent wpa_supplicant from connecting to a network

17,864

Solution 1

You can set the option disabled=1 in the corresponding network entry in wpa_supplicant.conf. This will prevent wpa_supplicant from automatically connecting to the network (it'll still try to connect to it if you specifically ask it to do so).

Solution 2

It appears that you can't. While you can set "disabled=1" for any given rule, that disables the rule for that connection, but doesn't block other rules that might match. So if you have it configured to auto-connect to open WiFi, that catch-all rule will still match even if you have a separate one for the specific SSID that is disabled.

Obviously, this is only an issue for open networks (which typically then require some sort of login to get real access). If there were a password, then the "disabled=1" option, or just removing the entry altogether would obviously solve the problem.

Share:
17,864

Related videos on Youtube

n.r.
Author by

n.r.

Updated on September 18, 2022

Comments

  • n.r.
    n.r. over 1 year

    How can I persistently prevent a wireless interface using wpa_supplicant in roaming mode from connecting to a particular open network foo?

    This doesn't work:

    $ sudo wpa_cli
    > blacklist 00:11:22:33:44:55
    FAIL
    

    Nor does the following:

    /etc/network/interfaces:

    allow-hotplug wlan0
    iface wlan0 inet manual
      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    

    wpa_supplicant.conf:

    network={
     ssid="foo"
     key_mgmt=NONE
     priority=0
    }
    
  • DrBeco
    DrBeco almost 9 years
    where is this file on debian Jessie?
  • lgeorget
    lgeorget almost 9 years
    Usually it's /etc/wpa_supplicant/wpa_supplicant.conf
  • DrBeco
    DrBeco almost 9 years
    Thanks Igeorget. The directory exists and there are some scripts there, but no wpa_supplicant.conf. Maybe there is no configuration file at all in the default installation for Debian Jessie?
  • lgeorget
    lgeorget almost 9 years
    Hmm I guess not. You probably have to create it. You could look for an example in /usr/share/doc/wpa_supplicant... But the easiest is probably to use a graphical tool to configure your network such as NetworkManager or wpa_cli.
  • Joachim Breitner
    Joachim Breitner almost 9 years
    Here, it does not work in the presence of a catch-all entry; see this question about it.