Please help me use sudo without password

Good day, all. So… I did a fresh install of EndeavorOS KDE. I wanted to disable the system asking for password everytime I wanted to to do a sudo command, that’s what I’ve always done in every other distro because it seems less tedious for me and I often have to automate some stuff from inside gamescope session using bash shortcuts which can’t ask me for password. And I’ve never had a problem doing it before, even on vanilla Arch. I’ve edited the sudoers file as I shudve. Even changed all the groups’ (wheel, sudo and root and even my user id itself) command permissions to NOPASSWD: ALL in the file.

Can anyone please help me get through this ?

Instead of directly editing /etc/sudoers, I would create a drop-in file in the user’s name in /etc/sudoers.d with the following content:

UserName ALL=(ALL) NOPASSWD: /usr/bin/xxx, /usr/bin/yyy, etc.

replacing UserName with the actual user name and xxx (etc.) with the command.

There might be better ways of doing so but this has worked for me when I have tried it before.

2 Likes

hello @Talon57,

welcome to the purple universe :enos: :enos_flag: :penguin_face: :rocketa_purple:

Damn, tnx bruh @pebcak . Dunno how to thank you enough. Seems the sudoers.d WAS the problem. Just uncommented the line in the sudoers file that told the file to @includedir the sudoers.d and it WORK

2 Likes

Thanks. How do I close the thread btw ?

1 Like

You could mark the post giving you the solution as such.

Click on … and check the box.

The thread will close automatically 2 days after the last reply.

Another couple of examples showing how some extra options can be used:

# cat /etc/sudoers.d/nopasswd
Defaults env_keep += SSH_AUTH_SOCK
Defaults !requiretty

root	ALL=(ALL:ALL) NOPASSWD: ALL
%wheel	ALL=(ALL:ALL) NOPASSWD: ALL
#  cat /etc/sudoers.d/nagios
Defaults !requiretty

nagios	ALL=(root)	NOPASSWD:	/usr/sbin/service
nagios	ALL=(root)	NOPASSWD:	/sbin/zpool status, /sbin/zpool status *
nagios	ALL=(root)	NOPASSWD:	/usr/local/sbin/sanoid --monitor-snapshots
#