I use a lot of minimal installs on various ARM devices. They’re good because they’re quick to download and you can test most of the functionality of the device to ensure it’s working or to quickly test specific functionality but of course it doesn’t have a GUI to use the nice graphical tools which are useful to quickly connect to a wifi network or other things.
This where nmcli comes in handy to quickly do anything you can do with the GUI. To connect to a wireless network I do:
Check you can see the wireless NIC and that the radio is enabled (basically “Airplane” mode):
# nmcli radio WIFI-HW WIFI WWAN-HW WWAN enabled enabled enabled enabled # nmcli device DEVICE TYPE STATE CONNECTION wlan0 wifi disconnected -- eth0 ethernet unavailable -- lo loopback unmanaged --
Then to actually connect to a wireless AP:
# nmcli device wifi rescan # nmcli device wifi list # nmcli device wifi connect SSID-Name --ask
And that should be enough to get you connected. You can list the connection with nmcli connection and various other options. It’s pretty straight forward.
You can also use nmtui(-connect) for it.
Use HISTCONTROL=ignoreboth in bashrc and then just add space before command to not get it added to bash history.
nmcli will ask for the password if you use the “–ask” argument.
if you don’t wan’t your password to be stored in the command line history use the –ask parameter like so:
# nmcli –ask device wifi connect SSID-Name password wireless-password
If you provide ask you do not have to provide password wirelesspassword
The only complaint I have is that it doesn’t prompt for a password if you leave it out so it means the AP password is stored on the command line history.
Thank you! I was just searching on how to write my wifi credential in a custom Fedora Live USB and found this. Also, the whole blog seems interesting!
How to connect to a wifi network using manual parameters for IP, netmask, gw and DNS ?
I’ve tried to append to that command “ipv4.method manual ip4 1.1.1.1/24 gw4 1.1.1.2 ipv4.dns 2.2.2.2” and got unknown parameter for all of then, except they work with a cabled ethernet connection.
never mind, I found the answer at: https://unix.stackexchange.com/questions/270217/how-to-connect-to-wifi-using-nmcli-with-a-static-ip-address-and-password
anyway: nmcli con add con-name xxx ifname wlan0 type wifi ssid SSID-HERE wifi-sec.key-mgmt wpa-psk wifi-sec.psk PASSWORD_HERE ipv4.method manual ipv4.address 192.168.100.100/24 ipv4.gateway 192.168.100.1 ipv4.dns 8.8.8.8,8.8.4.4