Start a shell script from php with root privileges

Discussion in 'General' started by teves, Oct 17, 2013.

  1. teves

    teves Member


    is there a way to start a shell script or a linux command with root privileges from a php script, that is executed by user ispconfig?
    I need to execute a shell script triggered by a form in a website. Apart from this the script should be kept as safe as possible though, so I am not going to allow just anyone to execute it.

    I have already tried to add the ispconfig user to /etc/sudoers and, from the console, I can execute the script as user ispconfig. But this does not seem to work in php.
    I suspect there is some apache security plugin getting in the way, but I need help to get around it.

    Could someone please give me a hint?

    Thank you very much,
    regards, Tom
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    using sudoers or sudo in general is quite risky and I wont do that on a server that is connected to the internet. A more secure way in doing this is to use the mechanisms that are available in ispconfig by using a action / evenats and serevr side plugins.

Share This Page