3

I used command-line tool for controlling NetworkManager (nmcli) to "Turn On Wi-Fi Hotspot", like following:

# nmcli device wifi hotspot ssid X password X ifname wlan1
Device 'wlan1' successfully activated with 'a8168e88-e391-45b9-95e3-5b66fb10fd31'.
# 

Is there a way preserve this state somehow? Otherwise after restart I have to re-run same command again.

0

1 Answer 1

4

You need to add connection not to change device properties. Something like this:

nmcli connection add con-name WiFi type wifi ifname wlan1 ipv4.method auto autoconnect yes wifi.ssid X wifi-sec.psk Y. 

I don't have WiFi interface on machine I'm currently using so I cannot test it. Let me know if it worked for you.

1
  • you are missing the wireless-security property. Like WPA-PSK. the property can be defined via 'wifi-sec.key-mgmt wpa-psk' Full command: ``` nmcli connection add con-name WiFi type wifi ifname wlan1 ipv4.method auto autoconnect yes wifi-sec.key-mgmt wpa-psk wifi.ssid ssid-name wifi-sec.psk wifipassword ```
    – Frankstar
    Commented Feb 15, 2023 at 9:58

You must log in to answer this question.

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