Run superuser command from perl-CGI script via apa

2019-07-29 03:00发布

问题:

I do have a script where I can run native OS command (non-superuser command)

#!/usr/bin/perl
print "Content-type: text/html\n\n";
system("ls -lrt");

and this works fine. System Command output is displayed on Web page..

However, I have my own binary "get_stats" (with super-user privileges) placed at /sbin directory. But web page appears blank, system command output is not displayed on the webpage.

#!/usr/bin/perl
print "Content-type: text/html\n\n";
system("get_stats");

What are the changes required to be done in apache config or /etc/sudoers??

Thanks Abhishek

标签: perl apache cgi