title: rbenv Permission denied with Assetic on Ubuntu
body: <p>I struggled for hours trying to have Assetic with Sass and Compass working on my production server.</p>
  
  <p>The error is: </p>
  
  <pre><code>sh: 1: /root/.rbenv/shims/ruby: Permission denied
  </code></pre>
  
  <p>This is because my rbenv instalation is under the /root directory so Assetic doesn't have the permision to use it.</p>
  
  <p>I've checked similar issues:</p>
  
  <ul>
  <li>"<a href="https://stackoverflow.com/questions/27213078/rbenv-permission-denied-issue">Rbenv permission denied issue</a>"</li>
  <li>"<a href="https://stackoverflow.com/questions/9951043/rbenv-permission-denied?rq=1">rbenv: Permission Denied</a>"</li>
  <li>"<a href="https://stackoverflow.com/questions/16815750/should-rbenv-be-installed-system-wide-or-at-a-user-level">Should rbenv be installed system-wide, or at a user level?</a>"</li>
  </ul>
  
  <p>but they didn't help. </p>
  
  <p>I'm using Apache so I guess the default user is "www-data".</p>
  
  <p>As explained in one of the above questions, I tried to grant www-data the permission in /root but either this didn't work or I did it wrong.</p>
  
  <pre><code>sudo chown -R www-data ~/.rbenv
  </code></pre>
  
  <p>This is the complete error:</p>
  
  <pre><code>[exception] 500 | Internal Server Error | Assetic\Exception\FilterException
      [message] An error occurred while running:
      '/root/.rbenv/shims/ruby' '/usr/local/bin/compass' 'compile' '/var/www/myapp/app/cache/dev' '--boring' '--images-dir' '/var/www/myapp/app/../web/uploads/img' '--config' '/var/www/myapp/app/cache/dev/assetic_compassu3IAzJ' '--sass-dir' '' '--css-dir' '' '/var/www/formation-hero/app/cache/dev/assetic_compassPbwM3H.scss'
  
      Error Output:
      sh: 1: /root/.rbenv/shims/ruby: Permission denied
  </code></pre>
  
  <p>I'm using Apache on Ubuntu 14.04</p>
  
  <pre><code>#  which ruby
  /root/.rbenv/shims/ruby
  
  # which compass
  /usr/local/bin/compass
  
  # which rbenv
  /root/.rbenv/bin/rbenv
  
  # rbenv -v
  rbenv 1.0.0-14-gc388331
  </code></pre>
  
  <p>Symfony 2.7 is installed under /var/www/myapp/</p>
  
  <p>What should I do to either give right to Apache to use the /root repository or, maybe better, how do I install rbenv for my Symfony2 project?</p>
  
  <p>Everything is working fine on my localhost with OS X.</p>