Greetings to all experts. Faced such a problem. There is a server, there are a lot of users on it with their own web sites. I am writing admin panel to help manage files of various users. How to manage the files of all users using php? Maybe as a thread can work in php from the root?

    1 answer 1

    There is an idea: to create a script that will perform the required actions and call it from php.

    <?php$output = shell_exec('script.sh');echo "<pre>$output</pre>";?> 

    And when executing the script, transfer the php root rights by placing it in the sudo list

     apacheusername ALL=(ALL) NOPASSWD: /usr/bin/php -f /home/user/script.php 

    The idea requires refinement.

    • Are there any other options? - Alexey Ognev.