Apache2 server run script as specific user
<p>I am using Ubuntu server 12.04 to run Apache2 web server.</p>

<p>I am hosting several webpages, and most are working fine.</p>

<p>One page is running a cgi script which mostly works (I have the python code working outside Apache building the html code nicely.)</p>

<p>However, I am calling a home automation program (heyu) and it is returning different answers then when I run it in my user account.</p>

<p>Is there a way I can...</p>

<p>1 call the heyu program from my python script as a specific user, (me) and leave the rest of the python code and cgi code alone?</p>

<p>2, configure apache2 to run the cgi code, as a whole, as me? I would like to leave all the other pages unchanged. Maybe using the sites_available part.</p>

<p>3, at least determine which user is running the cgi code so maybe I can get heyu to be OK with that user.</p>

<p>Thanks, Mark.</p>

<p>It looks like I could use suEXEC.</p>

<p>It is an Apache module that is not installed at default because they really don't want you to use it. It can be installed using the apt-get scheme.</p>

<p>That said, I found the real answer to my issue, heyu uses the serial ports to do it's work. I needed to add www-data to the dialout group then reboot.</p>

<p>This circumvented the need to run my code as me (as I had already add me to the dialout group a long time ago) in favor of properly changing the permissions.</p>

<p>Thanks.</p>

php python apache