You are not logged in.

#1 2023-09-27 06:01:13

Frontear
Member
Registered: 2023-05-22
Posts: 29

[SOLVED] sudoers.d drop-in file not correctly applying

I'm trying to make a sudoers.d file that allows me to run powertop without requesting sudo. This is the format of the file (written using visudo -f /etc/sudoers.d/powertop)

%wheel ALL=NOPASSWD: /usr/bin/powertop

This does not seem to work, despite the fact that visudo doesn't report any errors. If not syntax errors, is this some kind of semantic error? I'm not sure what's going on, any ideas?

EDIT: Just merged some of my files together, also using visudo. The %wheel perms to run ALL commands work, but nothing else, even after a logout-login. The third line is pulled pretty much straight from the wiki, only difference is that I chose to make it a wheel group option rather than just user specific, nothing besides the first entry seems to actually "work".

%wheel ALL=(ALL:ALL) ALL

%wheel ALL=NOPASSWD: /usr/bin/powertop
%wheel ALL=NOPASSWD: /usr/bin/systemctl poweroff, /usr/bin/systemctl halt, /usr/bin/systemctl reboot

Last edited by Frontear (2023-09-28 05:27:48)

Offline

#2 2023-09-27 07:11:39

seth
Member
Registered: 2012-09-03
Posts: 59,897

Re: [SOLVED] sudoers.d drop-in file not correctly applying

that allows me to run powertop without requesting sudo

Just to be sure: you're trying to "sudo /usr/bin/powertop" but it's still asking for a password?
In that case

sudo -l
id

Otherwise, sudoers doesn't add a suid (process implicitly runs as root) and that's also not a good idea.

Offline

#3 2023-09-27 11:46:15

Frontear
Member
Registered: 2023-05-22
Posts: 29

Re: [SOLVED] sudoers.d drop-in file not correctly applying

$ sudo -l
User frontear may run the following commands on frontear-net:
    (ALL : ALL) ALL
    (root) NOPASSWD: /usr/bin/powertop
    (root) NOPASSWD: /usr/bin/systemctl poweroff, /usr/bin/systemctl halt, /usr/bin/systemctl reboot
$ id
uid=1000(frontear) gid=1000(frontear) groups=1000(frontear),998(wheel)

Everything looks fine?

Offline

#4 2023-09-27 14:47:54

seth
Member
Registered: 2012-09-03
Posts: 59,897

Re: [SOLVED] sudoers.d drop-in file not correctly applying

Yes, does

sudo /usr/bin/powertop

still ask you for a password?

Offline

#5 2023-09-28 05:27:36

Frontear
Member
Registered: 2023-05-22
Posts: 29

Re: [SOLVED] sudoers.d drop-in file not correctly applying

seth wrote:

Yes, does

sudo /usr/bin/powertop

still ask you for a password?

Remade the files after rm, and it works as prescribed. I'm gonna chalk it up to either some perm or other weird quirk, I know sudo is quite temperamental

Offline

Board footer

Powered by FluxBB