Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I heard that the MPM-ITK module for Apache can change Apache server's behaviour to access some folder / file using the UID or GID from the default UID (www-data) into a given UID on the configuration.

For example:

<IfModule mpm_itk_module>
AssignUserId user group

Is it possible to make the username and group a variable?

I want to make Apache access the /home folder as its owner. For example /home/me can only be accessed by the user me, while /home/you can only be accessed you.

share|improve this question

migrated from superuser.com Sep 9 '12 at 16:43

This question came from our site for computer enthusiasts and power users.

3 Answers 3

I haven't tried using AssignUserId per Location or Directory in Apache, but it does work for different virtual hosts, like so:

<VirtualHost *:80>
    ServerName my.domain.com
    DocumentRoot /home/me
    AssignUserID me me

<VirtualHost *:80>
    ServerName your.domain.com
    DocumentRoot /home/you
    AssignUserID you you
share|improve this answer

You can use mod_macro.

Define one VirtualHost macro an use it with Use

<Macro Hosting $who>

    <Directory "/home/$who">
        allow from all
        Options +FollowSymLinks

    <VirtualHost *:80>
        ServerName $who.domain.com
        AssignUserId $who $who

Use Hosting me
Use Hosting you
share|improve this answer

From Apache 2.4 on, mpm-itk has the AssignUserIDExpr and AssignGroupIDExpr directives, which allows an Apache expression to be used in dynamically defining a user and group. In combination with mod-rewrite it will probably do what you want.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.