Ruby on rails 添加日志文件,防止AWS上的“rails c”访问

Ruby on rails 添加日志文件,防止AWS上的“rails c”访问,ruby-on-rails,ruby-on-rails-4,permissions,amazon-elastic-beanstalk,Ruby On Rails,Ruby On Rails 4,Permissions,Amazon Elastic Beanstalk,昨天我在rails应用程序中为我的delayed_作业添加了一个新的日志文件,现在当我ssh进入AWS实例时,我无法启动rails控制台 错误显示为: Rails Error: Unable to access log file. Please ensure that /var/app/current/log/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /va

昨天我在rails应用程序中为我的
delayed_作业添加了一个新的日志文件,现在当我
ssh
进入AWS实例时,我无法启动rails控制台

错误显示为:

Rails Error: Unable to access log file. Please ensure that /var/app/current/log/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /var/app/current/log/production.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
/opt/rubies/ruby-2.2.5/lib/ruby/2.2.0/open-uri.rb:36:in `initialize': Permission denied @ rb_sysopen - /var/app/current/log/delayed_job.log (Errno::EACCES)
这很奇怪,因为
production.log
在我的应用程序中已经存在很长时间了,我以前从未见过这个错误

我试着做了
sudo chmod 0664/var/app/current/log/production.log
sudo chmod 0664/var/app/current/log/delayed_job.log
,但仍然出现同样的错误


我对这两个文件的文件权限都是
-rw-rw-r--
。我需要让所有用户都可以写吗?我不想直接这样做,因为我不确定它是否安全。

因此我通过运行以下命令修复了上述问题:

sudo chmod 0777/var/app/current/log/delayed_job.log
sudo chmod 0777/var/app/current/log/production.log

我最终确实为所有用户提供了读写访问权限,但我认为这是必需的,因为AWS无法以其他方式获得访问权限。

从长远来看,您是否有了更“简单”的解决方案?每当我想在AWS上运行rails c时,我都需要这样做。谢谢你的提示!