1

I'm running Ubuntu 12.04. I want a script to be able to run "ip link blah blah...".

sudo ./myscript.sh

works as intended, but

./myscript.sh

gets me : RTNETLINK answers: Operation not permitted

I have these lines in my sodoers file:

myusername ALL = (ALL:ALL) NOPASSWD: ALL
%mygroup ALL = (ALL:ALL) NOPASSWD:/sbin/ip, /bin/ip

There are no lines following this except a timeout for the timestamp, and the default reference to /etc/sudoers.d

/etc/sudoers.d is empty except for the default README file.

NOPASSWD does not seem to be working either. I have tried moving the lines around so that the timeout and sudoers.d lines are before the ones I mostly care about, with no effect.

What have I missed?

1 Answer 1

1

The /etc/sudoers file only applies to sudo. That means that if you do not run programs with sudo, it will not get a chance to get elevated privileges. You must use sudo ./myscript.sh or edit the script and change something like:

ip link ...

to:

sudo ip link ...
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .