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

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

1 Answer 1

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

 
discard

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.