title: Handling Paperclip folder and file permissions using Ruby on Rails
body: <p>I am running <em>Ruby on Rails 3.0.9</em> in production mode on a remote VPS machine running <em>Ubuntu 10.04 LTS</em> (in development mode I use RoR on a MAC OS Snow Leopard) and I would like to know how to manage the following scenario.</p>
  
  <p>I use <em>Apache2</em> and <em>Phusion Passenger</em> and I have set Virtual Host as-like this:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName project_name.com
    DocumentRoot /srv/www/project_name.com/public
  
    &lt;Directory /srv/www/project_name.com/public&gt;
      AllowOverride all
      Options -MultiViews
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>More, I use the <em>Paperclip</em> gem and, as a lot of people on the web using it in production mode, I get the following error on handling (image) files:</p>
  
  <pre><code>Errno::EACCES (Permission denied - /srv/www/project_name.com/public/images/001):
  ...
  </code></pre>
  
  <p>I heard that a solution in order to avoid those kind of errors is to set properly folder permissions (manually! - I don't know if it is possible to automate that "setting" process... BTW: is it possible?) but I think there is a better way to solve that. If so, <strong>what can\should I do?</strong></p>