26

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/

9
  • did you check this question askubuntu.com/q/8322/169736 ?
    – Braiam
    Nov 15, 2013 at 22:27
  • From the man page of cnetworkmanager, I gather that it does nto support WPA2 enterprise.
    – Lord Loh.
    Nov 16, 2013 at 2:31
  • Can you edit your question and add that? Since nobody would figure out why for them works and yours don't. Also I recommend editing the title so people are able to find it easier. Then post your answer below ;).
    – Braiam
    Nov 16, 2013 at 2:42
  • added link with my network info.
    – Lord Loh.
    Nov 16, 2013 at 4:06
  • And the answer?
    – Braiam
    Nov 16, 2013 at 11:26

2 Answers 2

34
  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.

3
  • Thanks for explaining how to connect to a new wifi network
    – Normadize
    Sep 26, 2017 at 14:19
  • This still works in ubuntu 18.04 even during the live installer! Thanks! ifup did not work for me, so I used sudo ip link set wlan0 up
    – lucidbrot
    Apr 6, 2020 at 17:47
  • does that also create new AP names for you whenever you run this command on ubuntu 18.04?
    – ignacio
    Jul 24, 2020 at 11:24
15

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)

Usage :

 nmcli connection { COMMAND | help }
   COMMAND := { show | status | up | down | delete }

   show [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
    
4
  • Error: 'list' is not valid 'connection' command. (nmcli tool, version 1.2.6) Apr 18, 2017 at 20:59
  • 'list' has been replaced with 'show' in newer version of nmcli Apr 28, 2017 at 6:42
  • This doesn't seem to work anymore. For nmcli c up uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05 iface wlan1 I get "Error: invalid extra argument 'iface'."
    – Fred
    Jun 6, 2021 at 16:25
  • From nmcli c --help: the correct usage is nmcli c up uuid cd79a7a1-1cf4-49c3-ad58-21ab17d1ba05 ifname wlan1. So ifname instead of iface!
    – Fred
    Jun 6, 2021 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .