Running PHP plugin as root user not working in Linux

Dinesha

New Member
Hi All,

I am running php plugin in on top of form. Below is my PHP code.
<?php
exec('/usr/bin/sudo cp -avr /tmp/test.txt /etc/systemd/system/test.txt');
?>

Above PHP code is working when I am running in putty. But it's not working with PHP form plugin.

In the above PHP code, I am trying to copy and paste file from one folder to another folder as sudo.

Please help me how can I run my PHP code.

Thanks in Advance...
 
Last edited:
Unless you've set the user your web service runs as to have passwordless sudo (which would be a mind bogglingly bad idea), that's not going to work.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top