How to Stop Ubuntu Linux from Automatically Connecting to Wi-Fi Networks

The Network Hijack

Ubuntu Linux utilizes the NetworkManager daemon to handle all internet connections. By design, NetworkManager tries to keep you online at all times. When you enter the range of a Wi-Fi network that you have previously connected to, Ubuntu will automatically drop whatever connection it currently has and attempt to join that known network. This behavior is usually helpful, but it becomes a major problem in dense environments. For example, if you are working in a coffee shop and tethering to your secure phone hotspot, Ubuntu might suddenly disconnect you to auto-join the shop’s slow, unsecure public Wi-Fi simply because you used it once six months ago.

How to Disable Auto-Connect via the GNOME GUI

If you are using the standard Ubuntu desktop environment (GNOME), you can stop this behavior by editing the connection profile directly from the system settings.

1. Open the Settings application.

2. In the left-hand sidebar, click on Wi-Fi.

3. In the list of networks, find the specific network that keeps automatically connecting (it will usually be under “Known Networks”).

4. Click the small Gear icon (Settings) next to the network’s name.

5. In the window that appears, ensure you are on the Details tab.

6. Look for the toggle switch labelled Connect automatically.

7. Click the toggle to switch it to the Off position, and click Apply.

Ubuntu will remember the password for this network, but it will no longer force your computer to join it unless you manually select it from the Wi-Fi menu.

How to Disable Auto-Connect via the Terminal (nmcli)

If you manage an Ubuntu server or prefer using the command line, you can change this setting instantly using the NetworkManager Command Line Interface (nmcli).

1. Open your terminal.

2. First, list all your saved network connections by typing:

nmcli connection show

3. Locate the exact name of the offending network under the “NAME” column (e.g., “StarbucksWiFi”).

4. Execute the following command to disable the auto-connect flag, replacing the network name in quotes:

nmcli connection modify "StarbucksWiFi" connection.autoconnect no

5. The change takes effect immediately. The network profile is saved, but NetworkManager will now ignore it until you explicitly request a connection.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.