Welcome! Log In Create A New Profile

Advanced

Allow page to run bash script from another directory

Posted by jps 
jps
Allow page to run bash script from another directory
October 10, 2019 12:42PM
So I have an nginx server block that looks like this:
server {
listen 80;
ssi on;
server_name utils.mydomain.com;
location / {
root /home/webroot/html;
}
location /cgibin {
root /home/webroot/cgibin;
gzip off;
fastcgi_pass unix:/run/fcgiwrap/fcgiwrap-nginx.sock;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/webroot$fastcgi_script_name;
}
}

servers bash scripts just fine. But in one of the pages, I'm trying to run a shell script located somewhere else on the server, here's a simple example:
#!/bin/sh
echo "Content-type: text/html"
echo "<html><body>"
echo "Starting script:"
echo "<pre>"
/home/jps/Admin/new_lib param1 param2
cat << EOF
</pre>
<h3>Done.<h3>
</body></html>
EOF

I keep getting this error:
2019/10/10 09:12:46 [error] 57640#0: *4480 FastCGI sent in stderr: "/home/webroot/cgibin/agent/admin/new_lib_work: line 105: /home/jps/Admin/new_lib: Permission denied"

I tried using ACL controls to add the nginx user/group to the new_lib file with rwx perms, I tried even making nginx the owner of that whole folder. Always says permission denied. Is there a way to accomplish this? I don't want to do chmod 777. I'd like a somewhat secure way of doing this.

Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready