I want to allow run specify command on my website, through PHP exec() function, so i found the way, to add www-data in sudoers.d files to allow run specify commands without asking password.
I tried next things:
whereis hashcat -> hashcat: /usr/bin/hashcat
sudo visudo /etc/sudoers.d/www-data
and add next line www-data ALL=(www-data:www-data)NOPASSWD: /user/bin/hashcat
sudo -u www-data sudo hashcat
And then i get this: [sudo] password for www-data:
, that means it doesn't seems to workWhat can i do wrong, and what i should do then? And is my decision to do so correct? Is there a better and safer solution?
That problem is solved, by removing the (www-data:www-data)
so my "www-data: file in sudoers.d looks like: www-data ALL=NOPASSWD: /usr/bin/hashcat
Thanks all for answering and give me a hint to solve this! Especially thanks to @cyberbrain for my carelessness!