Unable to connect to any wifi with NetworkManager due to error: Secrets were required, but not provided

I was trying to connect to wifi from a CentOS 7 minimal installation using the following article:

But I started seeing the following error:

Unable to connect to any wifi with NetworkManager due to error: Secrets were required, but not provided

The reason the above error is showing is that NetworkManager is trying to reuse an existing connection, which shouldn’t happen. You need to delete the connection first.

nmcli con delete <SSID>

Now, you can connect with the following:

nmcli dev wifi connect <SSID> password <password>

How to connect CentOS Server to the Internet using USB Wifi Adapter?

I was recently working on an Asus RS300 server, installed with CentOS 7 minimal installation before placing it to the datacenter. I didn’t have any RJ45 cable to get this connected to the internet at home. I had a spare ‘Linksys wusb600n’ USB wifi adapter, that I wanted to try out. I connected it to the USB, and got the interface listed as wlp18s0b1 using ifconfig.

To connect this to wifi, we can use nmcli like the following:

Show the connection:

nmcli connection show

To connect to the wifi with the password, use the following:

nmcli dev wifi connect your-ssid password your-wifi-pass

Remember to replace ‘your-ssid’ with the wifi name of your and ‘your-wifi-pass’ with the password for your wifi.

Once you run the above command, this should get connected to the wifi. Now, you can see the connection details and up the device like the following:

nmcli connection show
nmcli connection up wlp18s0b1

Remember to replace ‘wlp18s0b1’ with the one you can see in ifconfig.

Good luck.