1

I have gone through other questions on connecting to a Wi-Fi network from a terminal. nmcli works from the command line if the password provided is correct. If the password is wrong:

  1. The network manager opens a dialog box asking for the right password
  2. The command doesn't exit till I click on "Cancel" (returns 4 on cancel)

Is there a way to try to connect to a network without having this dialog box pop up if there is an error?

I need this to connect to a Wi-Fi network from a ctrl + alt + F<num> terminal. Here it just keeps waiting and the prompt doesn't return.

rohithpr
  • 157
  • sounds like a bug, I suggest you file a bug report. You have several alternates, all outlined here - https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic – Panther Feb 24 '16 at 19:56
  • Network manager in full tty environment does print an error on console. You seem to have been trying this only in GUI with terminal emulator. Open tty2 with ctrl+alt+f2 , and try there – Sergiy Kolodyazhnyy Feb 24 '16 at 21:55
  • @Serg - I tried it in tty2; it's the same result. I am not getting the prompt back and when I shift to unity (ctrl + alt + f7) the network manager's dialog box is open. – rohithpr Feb 25 '16 at 03:45
  • I am using timeout to exit. It still opens a dialog box but my program gets to know that something is wrong. Syntax timeout 30 nmcli .... 30 indicates that the command will return after 30 seconds in case of an error. – rohithpr Mar 02 '16 at 15:53

1 Answers1

0

I do not see your Ubuntu release ID and I do not know why you want to avoid the NetworkManager GUI but here is an alternative to using NetworkManager:

  1. Put the connection name and attributes in /etc/network/interfaces. This will cause NetworkManager to ignore this interface as "unmanaged".
  2. See the Answer in ubuntu 14.04 connect to a wifi network using command line
Richard Elkins
  • 474
  • 4
  • 7