Bash script being executed in a php script -
i know there other posts this, have tried out solutions , fixes marked solution , none of them works me.
as title says, trying make php script execute bash script when being loaded in web server (apache).
i using wrapper saw in post, here wrapper.c:
#include <stdlib.h> #include <sys/types.h> #include <unistd.h> int main (int argc, char *argv[]) { setuid (0); system ("/bin/sh /var/www/html/scrip/debugport/testversion.sh"); return 0; }
this testversion.sh script:
#!/bin/bash screen -s skywars -x stuff "stop " cd /tmp pid=$(fuser -n tcp 12321 | awk '{print $1}') kill -9 $pid
and php code using:
<?php $message=shell_exec("./var/www/html/scrip/php_root"); print_r($message); ?>
when ./php_root (which compiled wrapper.c) works fine, when try load web server script doesn't work @ all.
it's permissions, used every permission in post's solution: execute root commands via php
the wrapper supposed make script executed root no matter user executes it, doesn't work.
thanks guys.
try check access script. may user of web-server can not run bash script.
Comments
Post a Comment