Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: mod_wsgi other user | 
 |   
| Author | 
  | 
 
ThomasT
 
 
  Joined: 05 Sep 2018 Posts: 8 Location: Germany
  | 
 Posted: Tue 16 Oct '18 19:22    Post subject: mod_wsgi other user | 
     | 
 
  | 
 
Hi, 
 
 
how can run the python script under a different user than apache? 
 
 
I tried:
 
 
WSGIDaemonProcess ThomasApp user=thomas 
 
WSGIScriptAlias /ThomasApp /usr/local/apache2/python/handler.py
 
 
but it still runs under user apache.
 
 
Additionally how can I set LD_LIBRARY_PATH so that handler.py can use some shared libs (*.so). E.g. those from Webshere MQ when using pymqi. Commandline and python shell works. 
 
 
Thomas | 
 
  | 
 
| Back to top | 
 | 
 
ThomasT
 
 
  Joined: 05 Sep 2018 Posts: 8 Location: Germany
  | 
 Posted: Thu 18 Oct '18 12:27    Post subject:  | 
     | 
 
  | 
 
I found the solution:
 
 
In wsgi.conf
 
 
WSGIDaemonProcess MyApp user=thomas
 
WSGIProcessGroup MyApp 
 
 
MyApp is a simply a name. | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Thu 18 Oct '18 16:28    Post subject:  | 
     | 
 
  | 
 
| Thanks for sharing | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |