1

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?

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .