Auto connect to free wifi - how to disable?

Hi I am new to Manjaro, and maybe I just overlooked a simple setting, but my Laptop always connects to free Wi-Fi and even prefers to connect to free Wi-Fi over Wi-Fi I already connected too. So far these Wi-Fi where always trustworthy, but still I want to decide which Wi-Fi I connect too.

easy
tell them (set them) to not auto connect
or modify the priority …

in which case there cannot be an automatism?
No? Yes? :wink:

Either delete those networks form network manager or in their properties untick the autoconnection. Does not seem very complicated to me.

Nachlese is correct. You can set up automation or do it manually, but not both. Manual and automatic are mutually exclusive conditions.

My recommendation is just pick and choose as you can without automation, and make sure you have a local firewall if you’re going to be on free/public wi-fi regularly since your OS may not have come with one by default.

Having your laptop connect to “free” or open wi-fis automagically is incredibly dangerous and should always be avoided.

There may be a way to disable autoconnect to Wi-Fi for all connections. I just tested it on my mini-PC and it worked. Hopefully it may be a fix that persists even after system restarts. The fix was found at: NetworkManager device autoconnect option: Meaning and status? - Fedora Discussion

Basically, all you need to do is:

  1. Identify your Wi-Fi interface. This can be done via several commands in a terminal - I used
    nmcli device show
    to confirm my mini-PC’s wifi interface name, which is wlo1:
    Screenshot_20240319_113301

  2. Enter the following command in a terminal (this worked for me as user - no sudo required):
    nmcli device set wlo1 autoconnect no (make sure you change wlo1 to your wifi device name)

See how that goes. It means that you will have to manually connect to all Wi-Fi connections, even your regular one, which may cause problems with any automatic network-related jobs when you start your machine. A fix for that could be to add a rule allowing autoconnect for your main connection to your /etc/NetworkManager/conf.d/ folder - I’m afraid that is beyond my knowledge level.

Autoconnect can easily be re-activated by running nmcli device set wlo1 autoconnect yes (which I just did on my system & my Wi-Fi immediately reconnected - make sure you change wlo1 to your wifi device name).

Alternatively, you might be able to skip the above and just add this rule to your /etc/NetworkManager/conf.d/ folder (I’m not sure what the file would be called - maybe wifiauto.conf - I don’t think the file name matters as long as the suffix is .conf:

[device]
match-device=interface-name:eth3 *(replace eth3 with your wifi device name)*
wifi.iwd.autoconnect=false

According to the manual (in a terminal: man 5 NetworkManager.conf):

If wifi.backend is iwd, setting this [wifi.iwd.autoconnect] to false forces IWD’s autoconnect mechanism to be disabled for this device and connections will only be initiated by NetworkManager whether commanded by a client or automatically. Leaving it true (default) stops NetworkManager from automatically initiating connections and allows IWD to use its network ranking and scanning logic to decide the best networks to autoconnect to next. Connections’ autoconnect-priority, autoconnect-retries settings will be ignored. Other settings like permissions or multi-connect may interfere with IWD connection attempts.

You may have to restart your network or reboot for the above to take effect.

Hopefully one of the above should provide a solution you can live with. The good thing about them is that changes are easily reversible by either re-enabling autoconnect via the nmcli command or by deleting the new configuration file from the /etc/NetworkManager/conf.d/ folder.

This will require the backend be set to iwd, as it uses wpa_supplicant by default.
https://wiki.archlinux.org/title/NetworkManager#Using_iwd_as_the_Wi-Fi_backend

So

Will need to be something like

[device]
match-device=interface-name:eth3 *(replace eth3 with your wifi device name)*
wifi.backend=iwd
wifi.iwd.autoconnect=false

(as well as have the iwd package installed)

1 Like

My error - I saw iwlwifi in my inxi -Fazy & mistakenly assumed that meant I was using iwd (although I didn’t try that method on my system - just the nmcli method). Thanks for picking up on that and providing the correct instructions @cscs