I am able to connect to a wireless network using nm-applet when running it in lightdm, however, it does not work in an openBox session that I start as myself (a user started X Session), but am not able to do so using nmcli.
I am running nmcli using sudo. After 90 seconds, I get a time out message. What could be wrong?
This is the configuration I must use -
92 Answers
In case the wireless interface is already connected to some other AP, first disconnect it using
nmcli con down <AP name>Example: Supposing interface is already connected to 'PreviousAP', then disconnect it using
nmcli con down PreviousAPNow for Connecting to new AP
Considering you know the AP name and password.
nmcli device wifi connect <AP name> password <password>Example: AP name: Connect-to-this. WPA/WPA2 PSK: iampassword123
nmcli device wifi connect Connect-to-this password iampassword123If you don't want to have the wireless password stored in your history in recent versions you can add
--askto havenmcliprompt you for missing information it needs (default behavior if password is not provided).
This will automatically create a file in /etc/NetworkManager/system-connections/ with the AP name, which will contain the configuration.
ls /etc/NetworkManager/system-connections/Connect-to-thisTested in Ubuntu 16.04 LTS.
3To turn on WiFi
sudo rfkill unblock wifi
nmcli networking onTo list WiFi Networks
nmcli connection showOutput should be something like this
NAME UUID TYPE TIMESTAMP-REAL
Rishbh-Q1000 cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05 802-11-wireless Thursday 18 September 2014 05:32:34 PM ISTncmli allows you to connect via The UUID or ID (NAME, SSID)
Usage :
nmcli connection { COMMAND | help } COMMAND := { list | status | up | down | delete } list [id <id> | uuid <id>] status [id <id> | uuid <id> | path <path>] up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>] down id <id> | uuid <id> delete id <id> | uuid <id>Example Usage in this case
Connect :
nmcli c up uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05or
nmcli c up id Rishbh-Q1000Connect on specific wlan interface :
nmcli c up id Rishbh-Q1000 iface wlan1or
nmcli c up uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05 iface wlan1Disconnect :
nmcli c down id Rishbh-Q1000or
nmcli c down uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05