I've seen how one can connect to a hidden wifi network using the following:

nmcli c add type wifi con-name $ssid ifname $adapter ssid $ssid
nmcli con modify $ssid wifi-sec.key-mgmt wpa-psk
nmcli con modify $ssid wifi-sec.psk $password
nmcli con up $ssid

In the code above the connection name is being set the same name as the SSID just for clarity.

However, this requires me to know the type of wifi authentication.

When connecting to a AP broadcasting it's SSID it appears that Network Manager can figure out what type of authentication is being used thus I only need to provide the password using something like this:

nmcli -w 30 device wifi connect $ssid password $password ifname $adapter

Is there a way to connect to a hidden wifi AP using nmcl such that I only need to provide the password, SSID and device and not the type of authentication used similar to how connecting to a non-hidden AP doesn't require me to specify authentication type?

3 Answers 3


When using nmcli with device wifi connect, try setting the hidden option to yes.

Excerpt from the manual[1]:

wifi connect (B)SSID [password password] [wep-key-type {key | phrase}] [ifname ifname] [bssid BSSID] [name name] [private {yes | no}] [hidden {yes | no}]
  Connect to a Wi-Fi network specified by SSID or BSSID. The command finds a matching connection or creates one and then activates it on a device. This is a
  command-line counterpart of clicking an SSID in a GUI client. If a connection for the network already exists, it is possible to bring up (activate) the existing
  profile as follows: nmcli con up id name. Note that only open, WEP and WPA-PSK networks are supported if no previous connection exists. It is also assumed that
  IP configuration is obtained via DHCP.

  If --wait option is not specified, the default timeout will be 90 seconds.

  Available options are:


    set to yes when connecting for the first time to an AP not broadcasting its SSID. Otherwise, the SSID would not be found and the connection attempt would

  [1]: https://developer.gnome.org/NetworkManager/stable/nmcli.html
  • Doesn't work on version 1.22.10 nmcli -w 30 device wifi connect somessid password hiddenpw hidden yes ifname wlan0 Output: Error: No network with SSID 'somessid' found. But if I add hidden no to a network broadcasting it's SSID then it works.
    – Chimera
    Mar 4, 2021 at 18:31
  • 2
    @Chimera Hidden SSID won't become accessible instantly. The easiest is just to execute the same command once again.
    – ᄂ ᄀ
    May 9, 2023 at 19:17
  • Or run nmcli device wifi rescan ssid <SSID> before connecting (as mentioned in another answer).
    – ᄂ ᄀ
    May 9, 2023 at 19:30

Usually nmcli device wifi connect "$SSID" is the solution here. This would create a new profile, if no profile exists yet.

However, that requires that NetworkManager found the network in the scan result, otherwise it doesn't know which settings to set. Since the network is hidden, it might not be there. To solve that, first explicitly scan for the SSID with nmcli device wifi rescan ssid "$SSID" so that you find it in the scan result (nmcli device wifi).

The right solution should be indeed what user234931 says (nmcli device wifi connect "$SSID" hidden yes), but I am not sure that actually works. Maybe it does, otherwise it should be fixed in NetworkManager :)


For user are still search just to add new profile without connecting to it with hidden network, you can use property called "wifi.hiden"

the nmcli tool, version 1.36.6

nmcli con add con-name test666xx type wifi wifi.hidden false  ssid hahahhaha

this command will create a new network profile.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .