linux连接隐藏网络,如何使用nmcli连接到隐藏的wifi网络

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?

我必须编写一个连接到隐藏的wifi网络的Linux桌面软件。如果网络没有隐藏,我的代码可以通过调用nmcli进行连接,但如果它被隐藏,则无法添加连接。但是,我可以使用网络管理器的GUI创建一个新网络,所以我认为这并非不可能。你有什么想法?

3 个解决方案

#1

13

Okay, I have the solution. We know the ssid and the password.

好的,我有解决方案。我们知道ssid和密码。

nmcli c add type wifi con-name ifname wlan0 ssid

nmcli con modify wifi-sec.key-mgmt wpa-psk

nmcli con modify wifi-sec.psk

nmcli con up

If we dont need the connection anymore:

如果我们不再需要连接:

nmcli c delete

#2

4

This works fine for me:

这对我来说很好:

nmcli dev wifi connect "abc" password 123 hidden yes

#3

-1

While doing some experimenting, I found that you can use both echnotux's and Pocokman's answers to get it to connect. i.e

在进行一些实验时,我发现你可以使用echnotux和Pocokman的答案来连接它。即

nmcli c add type wifi con-name ifname wlan0 ssid

nmcli dev wifi connect password hidden yes

nmcli c delete

This simplifies it quite a bit.

这简化了它。

你可能感兴趣的:(linux连接隐藏网络)