Forum Moderators: coopster
I am making an installer which will be run by the user in browser. However, I have to install some and modify some softwares on the system for which I will use different commands to download, compile and install. Now the problem is that if the user uses this GUI in the browser i.e by installing under web server then the scripts are executed with the php user permissions and not root. Is there any method in php that I can use to send commands in exec() or system() and those commands should be executed with the root user permissions?
I have the root access info with me.
If this is not possible in php then can I do it with PERL?
thank you
Just imagine someone that doesnt know what the below code does runs it as root -
rm -rf /
If you would be happy giving someone the privilege to run that command then there are ways of doing what you want.
The first I can think of is running php as root. Even the thought of that sends a shiver down my spine.
However if you want your file system to survive then DO NOT UNDER ANY CIRCUMSTANCE allow people who should not be give root access the ability to kill your system. There is a reason that root access is not granted to every person that accesses the system.
If people must run root commands from a remote system then get them to ssh (or whatever encrypted communication type you use) into the system and run them from a terminal.
I do not want to run PHP under root because this script is one-timer then removed from server forever. The purpose of this script is to configure servers to run a video-encoding and conversion software. Once it has configured the server we do not need it anymore and no stranger got to run it ever.
So besides, running php under root and using ssh, is there any other solution?
I want to give the user a GUI so that he can configure the options with ease and without going into technical details which may be too much to digest for him.
thank you
if you need to update software on the server then that should be done by an admin anyway, any joe user shouldn't be able to do this via GUI, there is a reason it was done this way.
so it seems a pointless excercise that will also put you in a position of programming for all possible server setups. If you make a mistake, you could be liable.
Lay out the instructions and have an admin do it
>> CPanel
yea
[google.com...]