perlsudocgi-bin

permission denied when using `sudo grep syslog` inside perl script (cgi-bin)


i have perl script inside my cgi-bin folder, what i want is grep syslog using sudo grep (because it is root), but i got this message

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

so, any solution to solve this problem ??


Solution

  • You should add the apache/nginx user to sudoers with NOPASSWD in order to work (Not very recommendable)