0

I have a Ruby on Rails website. It was working without problems for a few months, then suddenly in the last few weeks it has started displaying the following error:

Errno::EACCES in WelcomeController#index
Permission denied - /home/userName/appName/app/views/layouts/application.html.erb

This is fixed by running the command 'touch tmp/restart.txt', but the problem re-appears after a few hours.

I can't see anything in the log to indicate what is causing the problem, but I am not a Ruby on Rails developer so I'm not sure what to look for.

There is some suspicion that the site is being deliberately sabotaged although personally I find it unlikely.

If someone could help me to work out what the problem is I would really appreciate it.

alex rees
  • 59
  • 8

1 Answers1

0

Are the permissions/user of tmp directory properly set? According to this answer, doing a chmod 777 might solve it.

sudo chmod 777 tmp

In any case, does apache/nginx have access to read over /home/userName/appName/app/views/layouts/application.html.erb? As you said, it could be someone making changes to the live code, thus changing the permission/ownership unknowingly.

Community
  • 1
  • 1
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
  • I tried changing the log file to 777, but it didn't help. But I noticed /home/userName/appName/app/views/layouts/application.html.erb had 700 permissions, which seems strange. So I changed them to 644 like the other files, which seems to have fixed the problem. I'll monitor it for a couple of days and if the problem doesn't come back I'll mark this question as answered. What I don't understand is why this problem has only just started occurring and why it only appears intermittently. – alex rees Apr 08 '14 at 17:27
  • It could be one of the downstream users who has an incorrect file permission set. Check for the permission in a locally checked out copy of your repo, the permission might have been checked in erroneously. Correct that and make a commit if that is the case. – Anshul Goyal Apr 08 '14 at 20:16
  • Changing the permission of application.html.erb seems to have fixed it. It's a mystery why this became a problem in the first place, but thanks for your help in solving it! – alex rees Apr 10 '14 at 14:52
  • @alexrees Verify the file permission in your repo as well, most probably you will need to update it there as well. – Anshul Goyal Apr 10 '14 at 15:46