Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to hidden wifi network using nmcli

I have to write a linux desktop software which connects to a hidden wifi network. If the network is not hidden, my code can connect by calling nmcli, but if it is hidden, it can not add the connection. However, I can create a new network using the GUI of the Network Manager, so I think it is not impossible. Do you have any ideas?

like image 984
Pocokman Avatar asked Feb 18 '16 08:02

Pocokman


People also ask

How do I connect to a hidden WIFI in Nmtui?

I used the following workaround: Add your hidden wifi via nmtui ('Edit connections') and activate it by nmcli con up HIDDEN_WIFI_PROFILE_NAME . After this, it should be in the wifi list of nmtui.


1 Answers

Okay, I have the solution. We know the ssid and the 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 dont need the connection anymore:

nmcli c delete <connect name>
like image 199
Pocokman Avatar answered Sep 22 '22 05:09

Pocokman