Changing the Apache user.

Discussion in 'Installation/Configuration' started by Baggus, May 14, 2008.

  1. Baggus

    Baggus New Member

    Hi,

    I have a server running Ubuntu LTS 8.04 and i would like to change the user apache(+php) runs as.

    Basically, the below script should return "ftpuser".
    Code:
    <?php
    $cmd = "whoami";
    $output = shell_exec($cmd);
    echo "<pre>$output</pre>";
    ?>
    And so far, i have been completely failing at doing this.

    I have tried altering the /etc/apache2/envvars but this doesnt change anything, even after rebooting server or restarting apache.

    <background info>
    I have to do this so i can delete files apache creates through php ShellExec from an FTP client. (and php needs to be able to delete files that where uploaded through ftp with ShellExec('rm '.$filename);
    </background info>

    Any help would be greatly appreciated :)
     
  2. topdog

    topdog Active Member

    Why dont you use the group feature instead and use sguid on the directory to ensure that the files created inherit the directories group.
     

Share This Page