Fix NetworkManager Can't See Hidden SSID on Linux
Your Linux PC won't connect to a hidden Wi-Fi network? Here's how to add it manually in NetworkManager and make it stick.
Quick answer
Run nmcli device wifi connect 'YourHiddenSSID' password 'yourpassword' hidden yes — that's it.
Why this happens
Hidden networks don't broadcast their name (SSID) in beacon frames. NetworkManager on Linux has a quirk: when you try to connect to a hidden network through the GUI, it sometimes creates a connection profile but forgets to mark it as "hidden." The system then scans for visible networks, doesn't see the hidden one, and never tries to connect. I've seen this on Ubuntu 22.04 and Fedora 37 with both GNOME and KDE. The fix is simple once you know where to look.
Step-by-step fix
I'll give you two ways. The first uses the command line, which is faster. The second uses the GUI if you prefer clicking.
Method 1: Use nmcli (recommended)
Open a terminal. On Ubuntu or Debian, press Ctrl+Alt+T. On Fedora, same or search for Terminal.
Check your Wi-Fi interface name with:
nmcli device statusLook for the line where TYPE is
wifi. The DEVICE column shows something likewlan0orwlp2s0. Write that name down.Now run the connect command. Replace the parts in brackets:
nmcli device wifi connect 'YourHiddenSSID' password 'YourPassword' hidden yesUse the exact SSID. Capital letters matter. The
hidden yespart is what makes it work — it tells NetworkManager to send probe requests for this network even when the SSID isn't visible.After you press Enter, you should see:
Device 'wlan0' successfully activated with 'your-uuid'.Verify the connection is saved:
nmcli connection showFind your network name in the list. The TYPE should be
wifi.Test it. Turn Wi-Fi off and on again, or reboot. The computer should connect automatically.
Method 2: Use the GUI (GNOME example)
Open Settings, go to Wi-Fi. Click the three-dot menu or the gear icon next to the Wi-Fi toggle. Choose "Connect to Hidden Network."
If you don't see that option, click the "+" button (Add Network).
Enter the SSID exactly. Set Security to WPA2/WPA3 Personal (or whatever your router uses). Enter the password.
Here's the part most people miss: after saving, go back to the Wi-Fi list. Find the network (it might show as "Disconnected"). Click the gear icon on that connection.
Look for a checkbox that says "Connect automatically" — check it. Also look for "Hidden network" or "This network is hidden" — often it's not there in the GUI. That's why the CLI method is better: it sets the hidden flag correctly.
If the GUI method doesn't work, go back to Method 1. The CLI never lies.
Alternative fixes if the main one fails
Edit the connection file directly
If nmcli gives you an error like "Error: secrets were required, but not provided," the password might be missing. Edit the config file:
Find the connection file:
sudo ls /etc/NetworkManager/system-connections/You'll see a file named after your SSID or a UUID.
Open it with root:
sudo nano /etc/NetworkManager/system-connections/YourSSID.nmconnectionLook for the
[wifi]section. Add this line if it's not there:ssid-hint-masked=trueThis is the hidden flag. Also make sure
mode=infrastructureis there.In the
[wifi-security]section, check thatpsk=has your password. If it sayspsk-flags=1, remove that line and replace it withpsk=yourpassword.Save the file (Ctrl+O, then Ctrl+X).
Restart NetworkManager:
sudo systemctl restart NetworkManager
Check if the router is actually broadcasting
Get a phone or another laptop and try to connect to the hidden network. If no device can see it, the router might be in "stealth mode" or simply off. Log into your router admin page and make sure the SSID broadcast is enabled — then check the "Enable Hidden Wireless" option if you want it hidden.
Prevention tip
Once you have the connection working, save the config file. Copy it somewhere safe:
sudo cp /etc/NetworkManager/system-connections/YourSSID.nmconnection ~/backup-ssid.nmconnectionIf you reinstall Linux or move to a new computer, you can copy this file back to /etc/NetworkManager/system-connections/, run sudo chmod 600 on it, and restart NetworkManager. The connection will appear instantly.
Also: if you ever need to change the password later, don't use the GUI — it resets the hidden flag. Use nmcli connection modify YourSSID wifi-sec.psk newpassword instead.
Was this solution helpful?