Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Errno::EACCES Permission Denied

Rails 3.1 Passenger on Apache Development environment When I go to access the index (i.e. GET) for a route I get:

Errno::EACCES in Crb_agendas#index

Showing /var/www/crbagenda/app/views/layouts/application.html.erb where line #5 raised:

Permission denied - /var/www/crbagenda/tmp/cache/assets/E2C

Extracted source (around line #5):

2: <html>
3: <head>
4:   <title>CrbAgendas</title>
5:   <%= stylesheet_link_tag "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>

Rails.root: /var/www/crbagenda

When I go to the path mentioned (/var/www/crbagenda/tmp/cache/assets/E2C) there is no E2C folder and root (what apache is running as) owns the assets dir... not sure what I did wrong here.... or what else I could show to help.

like image 885
ScottJShea Avatar asked Nov 14 '11 20:11

ScottJShea


3 Answers

Update: Yeah this answer came from ignorance and then seemed to gain traction. Anyway, the real answer can be found in Austen Tomek's answer

Hacked around this by doing chmod 777 on the tmp directory so I am guessing it is my ignorance on the user/permissions settings.

like image 58
ScottJShea Avatar answered Oct 21 '22 10:10

ScottJShea


I found this post when I encountered this error and running chmod 777 is not the solution here.

You need to do some research on how to enable group permissions and configure apaches settings appropriately. Here is a Stack Exchange thread that details this rather well and contains useful links. Make sure apache has read, write and execute access to the appropriate directories but don't simply let ANYONE modify the directory. Locate your systems apache group and run chown and chmod -g+[What permissions apache needs goes here] I would suggest not running this with the -R option and to actively look into which permission apache needs for specific directories. Link to Stack Exchange thread regarding apache permissions and permissions in general

like image 17
Austen Tomek Avatar answered Oct 21 '22 12:10

Austen Tomek


I deleted the tmp folder completely, that worked for me. It just gets regenerated by the web server.

like image 14
Charlie Avatar answered Oct 21 '22 11:10

Charlie