You are not logged in.

#1 2021-03-15 19:40:48

Itzak
Member
Registered: 2021-02-03
Posts: 16

RTNETLINK answers: Operation not permitted

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

#2 2021-03-15 19:51:57

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 4,611

Re: RTNETLINK answers: Operation not permitted

You're probably trying to set an interface as UP that is already in the UP state.

Itzak wrote:

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.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2021-03-15 20:54:27

Itzak
Member
Registered: 2021-02-03
Posts: 16

Re: RTNETLINK answers: Operation not permitted

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

Board footer

Powered by FluxBB