Question: 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 - <http://www.depts.ttu.edu/ithelpcentral/solutions/wireless/>

Answer: 
1. 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 PreviousAP

```
2. Now 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 iampassword123

```

If you don't want to have the wireless password stored in your history in recent versions you can add `--ask` to have `nmcli` prompt 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-this

```

Tested in Ubuntu 16.04 LTS.
**To turn on WiFi**

```
sudo rfkill unblock wifi
nmcli networking on

```

**To list WiFi Networks**

```
nmcli connection show

```

Output 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 IST

```

`ncmli` allows you to connect via The **UUID** or **ID (NAME, [SSID](https://askubuntu.com/a/1004949/349837))**

**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-21ab17d1ba05

```

or

```
nmcli c up id Rishbh-Q1000

```
* ***Connect on specific wlan interface :***

```
nmcli c up id Rishbh-Q1000 iface wlan1

```

or

```
nmcli c up uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05 iface wlan1

```
* ***Disconnect :***

```
nmcli c down id Rishbh-Q1000

```

or

```
nmcli c down uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05

```