Command Line setting wireless connection with nmcli when SSID Wifi network ID is offline

Hi to all !

I would like to set a script on Fedora Workstation with the nmcli command to a specific SSID Wifi network ID beforehand, even if this SSID is offline. For example a Wifi hotspot from a mobile phone.

For now this command would work only if the SSID is online and detected by Gnome before executing it:

nmcli device wifi connect "<SmartPhone Wifi Hotspot SSID>" password xxxxxxxxx;

If this SSID is offline I get an error:

Error: No network with SSID 'SmartPhone Wifi Hotspot' found.

Any thoughts ?

1 Like
nmcli connection add \
    type wifi \
    wifi.ssid "SSID" \
    wifi-sec.key-mgmt wpa-psk \
    wifi-sec.psk "KEY"

nm-settings-nmcli: NetworkManager Reference Manual