Aug 10, 2011
tom

To what extent does mod_suexec interact with Passenger?

Question

On a shared server (specifically a DreamHost shared server running Debian, but I don’t know if this matters) with mod_suexec activated and with PHP and Python forced to use CGI or FastCGI, would you expect Passenger processes to be run as the Apache user or as the user from whose home directory the Passenger-powered app is run?

Please explain the basis for your answer.

(I’m guessing the latter, for consistency with DreamHost’s approach to PHP and Python, but I’m vague on how Passenger interacts with Apache, let alone with mod_suexec.)

Answer

mod_suexec is specific to CGI setups, which a completely different technology from passenger.

Passenger implements its own way of user switching. The user applications are run as is determined broadly according to the following:

  1. If we are a Rails app, run as the owner of config/environment.rb. If we are a Rack app, run as the owner of config.ru.
  2. If the determined user would be root, use the configured PassengerDefaultUser
  3. If this still would be root (or unconfigured), run as the user, Apache runs at (e.g. wwwrun or www-data).

For more information, see http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching

Related posts:

  1. phusion passenger, apache2 only works with www
  2. Why does installing libapache2-mod-passenger require Ruby 1.8?
  3. Strange error when using Rails with Passenger
  4. How to achieve zero downtime with Passenger 3?
  5. RMagick on EC2/Nginx/Passenger performance is horrible

Leave a comment