Run Apache as a specific user with mpm itk on Ubuntu Linux

Install mpm itk

On ubuntu mpm itk can be installed from synaptic. Look for the package called apache2-mpm-itk

sudo apt-get install apache2-mpm-itk

Configure

Configuration for mpm itk can be done in the file sites-enabled/000-default

$ gksudo gedit /etc/apache2/sites-enabled/000-default

In the VirtualHost *:80 section add this just before the end of the VirtualHost tag

<IfModule mpm_itk_module>
AssignUserId your_username your_username
</IfModule>

</VirtualHost>

Restart apache. Now apache should be running as that username specified in "your_username".
Now this means that even PHP scripts will also run with the same username (unless something like suexec/suphp is changing their user).






Last Updated On : 8th December 2011

Subscribe to get updates delivered to your inbox

1 Comment + Add Comment

  • I get errors trying to apt-get install

    [email protected]:~$ sudo apt-get install apache2-mpm-itk
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package apache2-mpm-itk is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘apache2-mpm-itk’ has no installation candidate

Leave a comment to Denver Prophit Jr