I'm trying to set up some tasks on my internal web server to be called from a web page. The PHP script calls my C program, and my question is this:
If I call an external program in a C program, for example
and compile the program as root but then change the ownership of the compiled program to www-data so as to be executed by the apache process, will it still perform the mv command with root privileges? I need to be able to run these commands with root privileges unfortunately, and do not want to add sudo privileges to www-data or anything else as obtrusive as that.
system("mv /etc/testfile /backup/");
Thanks in advance!