Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a server running several vhost sites, and was wondering if there could be a way to get some vhost PHPs executed under a different user/group depending on the client connecting to them. I figured it could go like:

  1. client connects via https
  2. client may present SSL certificate (or not)
  3. server decides whether to:
    • if no certificate was given, run PHP under user1/group1
    • if a certain whitelisted certificate, and certain cookie are sent by the client, run PHP under user2/group2

Does anybody know if something like this would be possible?

share|improve this question

This is probably technically possible, but it would require a lot of manual work to get that to function. I don't believe a per-request functionality exists that would allow you to set the running user/group.

The problem is that to drop down to a different user/group, you would need the code making this determination to be running as root. Even if you used an intermediary script that makes this determination, it is not at all likely to be running as root and therefore can't just "drop down" to a different user since there would be no dropping down happening.

So I think that without a ton of work: no.

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.