Hey everyone,
fresh install of EOS with KDE. Single user system, ticked the box on install to use my pwd for administrative stuff.
I want to be able to do system updates (yay in terminal) without typing my password.
I have tried
sudo visudo
and then multiple things:
added
myusername ALL=(ALL:ALL) NOPASSWD: /usr/bin/yay, /usr/bin/yay -Syu
, or tried uncommenting
the wheel group NOPASSWD line
even tried putting a file in /etc/sudoers.d/ with my username and
myusername ALL=(root) NOPASSWD: ALL
but still everytime I type yay into Konsole in a fresh session it asks for my password.
What am i missing?
Any help would be greatly appreciated!
Thanks
I quote this from another forum, explains it well:
If there are multiple matching entries in /etc/sudoers
, sudo uses the last one. Therefore, if you can execute any command with a password prompt, and you want to be able to execute a particular command without a password prompt, you need the exception last.
myusername ALL=(ALL) ALL
myusername ALL=(root) NOPASSWD: /path/to/my/program
Note the use of (root)
, to allow the program to be run as root but not as other users. (Don’t give more permissions than the minimum required unless you’ve thought out the implications.)
I think you can drop the part with the command parameters, because you already gave the permission to the usage of yay as a whole.
Does not work unfortunately…
Added
myusername ALL=(ALL:ALL) ALL
myusername ALL=(root) NOPASSWD: /usr/bin/yay
at the end of the sudoers file (via sudo visudo)
but no success, still asks for my password
Only add the second line at the end, the first is only for explanation.
Still asks for the password, even then
Can you try this at the very end of the file, temporary and remove it after testing:
%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/yay
It will give the privileges to the wheel group
Edit:
Just tried the following on my own system, worked well for me:
svartiz ALL=(ALL:ALL) NOPASSWD: /usr/bin/yay
Guess there’s something else on your system that conflicts.
Still not working, sorry!
Thats weird.
I don’t understand the conflict
Nothing I change in visudo seems to impact the Konsole
how do you quit visudo?
Press ESC and then
you should use “:wq” to quit it.
I know it isn’t recommended but have you tried editing the sudoers file with
sudo nano /etc/sudoers
Sudo uses dropin files now… edited the 10-installer file in /etc/sudoers.d/ and now it’s working… sorry for the inconvenience!
1 Like
I do it like this
Create /etc/sudoers.d/admin_cmds
which contains this structure
Cmnd_Alias ADMIN_CMDS = /usr/bin/yay, /usr/bin/btrfs
%wheel ALL = NOPASSWD: ADMIN_CMDS
Note that my user is in group wheel
I should also mention that /etc/sudoers
must have something like this at the end
## Read drop-in files from /etc/sudoers.d
@includedir /etc/sudoers.d
1 Like
Another important point.
Run
sudo -l
to see what you are allowed to do when running sudo.
1 Like
system
Closed
May 21, 2024, 9:59am
13
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.