run sh file with plugin

onurtasci

New member
Joined
Dec 5, 2021
Messages
4
Hello,

I am making a plugin and I want to run a command with php shell_exec when the plugin index.html opens, but I could not succeed.


URL: /admin/plugins/customPlugin?path=index.html


index.html;

#!/usr/local/bin/php -n
<?php

echo shell_exec('sh /scripts/startCode');
 
check if "shell_exec" is on the list for prohobited commands in CSF. usually it is.
 
Finally, when I edit the code like this, it works, but now I'm getting an authorization error, how can I solve it?

shell_exec('/usr/bin/sh /scripts/startCode 2>&1');
/usr/bin/sh: /scripts/startCode: Permission denied

shell_exec('whoami') ==> admin

./startCode my file needs to run with root privilege
 
Back
Top