How to connect to a hidden Wi-Fi network using nmcli

I need to write software for Linux that connects to a hidden Wi-Fi network. If the network is not hidden, my code can connect by calling nmcli, but if it is hidden, it cannot add the connection. However, I can create a new network using the Network Manager graphical interface, so I think this is not possible. Do you have any ideas?

+6
source share
3 answers

Ok, I have a solution. We know the ssid password and password.

nmcli c add type wifi con-name <connect name> ifname wlan0 ssid <ssid> nmcli con modify <connect name> wifi-sec.key-mgmt wpa-psk nmcli con modify <connect name> wifi-sec.psk <password> nmcli con up <connect name> 

If we no longer need a connection:

 nmcli c delete <connect name> 
+9
source

This works fine for me:

 nmcli dev wifi connect "abc" password 123 hidden yes 
+2
source

During some experiments, I found that you can use both echnotux and Pocokman answers to connect it. i.e

 nmcli c add type wifi con-name <connect name> ifname wlan0 ssid <ssid> nmcli dev wifi connect <ssid> password <password> hidden yes nmcli c delete <connect name> 

This simplifies it a bit.

0
source

All Articles