Im working on a C++ program that can execute terminal commands for me, and one of its functions is wifi manipulation (connect, disconnect, forget). Right now I am trying to execute a wifi connection command in the terminal using the ff.:
nmcli device wifi connect <wifiName> password <password>
Above works fine in the terminal when the password is right, but it shows a popup asking for the correct password when the supplied password is wrong:
Is there a way I can prevent the popup from happening, so my program doesn't pause indefinitely until I close it manually? Or is there a better command to handle wifi connection given the wifi name and password?
Best Answer
from
man nmcli
you can use below command.
but you may require few more details other than just
ssid
andpassword
the details here I used other than
ssid
andpassword
arethe
nmcli
command above will not popup as in your Question, It will popup a msg like in this gif file below which will not stop your work flow if the password is wrong...My required details are:
So the command to add this connection with the password is as above..
Observe the below gif at the end.. when I entered wrong password.. It did not disturb the running process.. Instead It Just Showed a Notification at the top, If we want to enter the password again, we can click it other wise Ignore..
Note: This method works if there are no connections exist.