1

I have a mobile broadband connection that I am often sharing via hotspot on Ubuntu 18.04.2 LTS and Gnome 3.28.2. I can perfectly do this (as described for example here) via GUI. But I would like to realize that with a CLI command (for a toggle switch. How can I determine the command behind this GUI button: WLAN Hotspot ?

slava
  • 3,887
schiggn
  • 13

1 Answers1

2

I am confused with the example you have provided in the question.. it uses Unity.. but 18.04 Defaults to GNOME

I assume you are using GNOME and not Unity..

Once you have created the hotspot in any way and once it is active..

run the below command
nmcli device show

and note down the value for GENERAL.CONNECTION:
in my case it is Hotspot-21

Example:

pratap@i3-6550U:~$ nmcli device show
GENERAL.DEVICE:                         wlp2s0
GENERAL.TYPE:                           wifi
GENERAL.HWADDR:                         E0:94:67:64:C5:8F
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     Hotspot-21

now use the commands below to toggle on and off (#Replace Hotspot-21 with your value)

nmcli connection up Hotspot-21
nmcli connection down Hotspot-21

enter image description here

Source: http://manpages.ubuntu.com/manpages/bionic/man1/nmcli.1.html

       wifi hotspot [ifname ifname] [con-name name] [ssid SSID] [band {a | bg}] [channel channel]
   [password password]
       Create a Wi-Fi hotspot. The command creates a hotspot connection profile according to
       Wi-Fi device capabilities and activates it on the device. The hotspot is secured with
       WPA if device/driver supports that, otherwise WEP is used. Use connection down or
       device disconnect to stop the hotspot.
PRATAP
  • 22,460
  • This is brilliant, exactly what I looked for. I am facing one last problem: As showed in your video I can switch the Hotspot off. But when switching on after a while I get an error as follows (translated from german): Error: Link activation failed: 802.1X supplicant took too long to legitimize Any idea where that might come from? – schiggn Mar 06 '19 at 08:27
  • no - when turning on via gui everything is ok. when i send the command nmcli connection up Hotspot it toggles the button stays on for a certain time and switches off again with above error... – schiggn Mar 06 '19 at 21:19
  • oddly when I switch on via GUI, down via nmcli and up via nmcli again, above error occurs, when I switch on via CLI from the beginning, everything is ok. Well, case closed! Thank you again! – schiggn Mar 08 '19 at 10:17