💾 Archived View for darknesscode.xyz › notes › no-password-with-sudo.gmi captured on 2024-02-05 at 09:39:32. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
I like to run some sudo commands with enter everytime my password.
There are a few ways to doing it, one is editing the sudoers file with visudo like so:
sudo visudo
Check if this two lines are In the file
## Read drop-in file from /etc/sudoers.d @includedir /etc/sudoers.d
That means that every file we created inside the sudoers.d directory it will be read for the sudoers file
Create a new file, Example
sudo visudo -f /etc/sudoers.d/killall
Now in our new file add (replace user with the real username)
user ALL=NOPASSWD: /usr/bin/killall
Save and close. This should work out of the box, run a program and kill it with
sudo killall <program>
Now you will see that the program is terminated without asking for your root password
----------
----------
© DarknessCode