Hey guys!
I have a script:
The thing is that, for example, I want to bind some of these commands to keys (e.g. using XFCE keyboard binding program), so I want them to not ask for passwords. Also, from what I've seen, in some cases, during the invocation of some of these scripts (in a CLI) that contain sudo commands, I am not able to input my password.
What would be a sensible way of doing this? I've added this line to
But it obviously doesn't work since I don't even call the script with sudo, the sudo commands are inside of it. Should I just add all the commands inside the script to there? E.g.:
But this may be a bit overkill for what I want to do. What do you guys think?
Thanks in advance!
I have a script:
~/.local/bin/did-keyboard
to manage the loading of xkeysnail with my specific configurations. I normally run it as did-xkeysnail --load
, and it asks me for my sudo password since I have multiple sudo commands in there: sudo kill ...
, sudo nohup xkeysnail
... (since xkeysnail must be run as root).The thing is that, for example, I want to bind some of these commands to keys (e.g. using XFCE keyboard binding program), so I want them to not ask for passwords. Also, from what I've seen, in some cases, during the invocation of some of these scripts (in a CLI) that contain sudo commands, I am not able to input my password.
What would be a sensible way of doing this? I've added this line to
/etc/sudoers
:
Code:
%wheel ALL=(ALL) NOPASSWD: /home/me/.local/bin/did-keyboard
But it obviously doesn't work since I don't even call the script with sudo, the sudo commands are inside of it. Should I just add all the commands inside the script to there? E.g.:
Code:
%wheel ALL=(ALL) NOPASSWD: /usr/bin/xkeysnail, /usr/bin/kill, /usr/bin/nohup
But this may be a bit overkill for what I want to do. What do you guys think?
Thanks in advance!