Reputation: 3216
Is it possible to set root permissions for php script
and manipulate with system folders:
For example:
I want to monitor file changes in specific folder and display it to browser
Upvotes: 0
Views: 1464
Reputation: 131831
You should take the other way round: Make the script readable (and only readable) for the user PHP is running under.
Allowing PHP to run with root rights with access from outside (=> browser) is .. just stupid.
Upvotes: 1
Reputation: 55022
yes, it is possible but not recommended unless your server is internal. In other words, if noone will have access to your server, you can do that, such as an internal application. exposing this to the world is highly discouraged.
How you can do this is to set your process to sudoers. if you are using this via httpd you can set the httpd process to sudoers.
Upvotes: 0
Reputation: 2453
try using sudo http://www.gratisoft.us/sudo/
an example of using sudo in php.net http://www.php.net/manual/en/function.exec.php#56274
Upvotes: 1