Closed dimitrisfasoulas closed 1 month ago
echo [PASSWORD] | sudo -S <cmd>
?
aaah ... that might work, but I think I prefer typing the password each time than hardcoding it to a script :)
aaah ... that might work, but I think I prefer typing the password each time than hardcoding it to a script :)
pkexec <cmd>
Hey dimitrisfasoulas!
Add the script or service to /etc/sudoers
using visudo
. Or add a config file to /etc/sudoers.d
Format like this:
yourusername ALL=(ALL) NOPASSWD: /home/yourusername/script.sh
Thnx simonm but if you look at my original post I've already added the script to sudoers:
I have a script that restarts a service. The script is added in sudoers: myusername ALL=(ALL) NOPASSWD: /home/myusername/script.sh
Yes. My bad. Sorry about that
On Sat, Jun 8, 2024, 22:09 Dimitris Fasoulas @.***> wrote:
Thnx simonm but if you look at my original post I've already added the script to sudoers:
I have a script that restarts a service. The script is added in sudoers: myusername ALL=(ALL) NOPASSWD: /home/myusername/script.sh
— Reply to this email directly, view it on GitHub https://github.com/hyprwm/hypridle/issues/42#issuecomment-2156167547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAARUZPUDN2A7H66B6C3EDZGNQIRAVCNFSM6AAAAABFXBWWUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGE3DONJUG4 . You are receiving this because you commented.Message ID: @.***>
Is it possible to invoke a script with sudo ?
I have a script that restarts a service. The script is added in sudoers:
myusername ALL=(ALL) NOPASSWD: /home/myusername/script.sh
and I'm able to invoke it with sudo without requiring password. But if I added to the listener like so:I get a prompt to provide sudo password.