You are not logged in.
I'm new to bash scripting and I was trying to someone make a simple bash script to connect to wifi using nmcli,
#!/usr/bin/env bash
function connect_wifi() {
ip link set wlo1 up
nmcli dev wifi connect [SSID] password [PASSWORD]
}
connect_wifi
When I execute the script it shows this:
RTNETLINK answers: Operation not permitted
But at the end, the script does connect to my wifi network.
Any idea why this happens? Also, can you tell me if this is a correct way to automate wifi connection? Thanks.
Offline
You're probably trying to set an interface as UP that is already in the UP state.
Also, can you tell me if this is a correct way to automate wifi connection?
No, it isn't.
If you want to use NetworkManager then just use the service files that it already provides.
Offline
Thanks for the reply. Removing the "ip link set wlo1 up" command got rid of the message.
I included that command because I was intending to use the function in a personal script to reinstall arch.
When you say NetworkManager service files, what do you mean? Like the front-end options?
Offline