当我尝试上传文件时,我在服务器上收到以下错误
Permission denied @ dir_s_mkdir - /var/www/noise/public/uploads/tmp/1422949577-24950-7745
我尝试向public
文件夹授予777权限。仍然收到错误
root@99atoms-staging:/var/www/noise# sudo chmod 777 /var/www/noise/
root@99atoms-staging:/var/www/noise# stat -c %a /var/www/noise/public
755
root@99atoms-staging:/var/www/noise# sudo chmod 777 /var/www/noise/public
root@99atoms-staging:/var/www/noise# stat -c %a /var/www/noise/public
777
服务器日志
App 24927 stderr:
App 24927 stderr:
App 24927 stderr: Started POST "/companies" for 122.172.197.148 at 2015-02-03 02:55:17 -0500
App 24927 stderr: Processing by CompaniesController#create as HTML
App 24927 stderr: Parameters: {"utf8"=>"?^?^?", "authenticity_token"=>"CNSqDFRAYxle0NpVIPqGXPYWMWkoYGRLDeqgmzwjiUE=", "company"=>{"name"=>"Mink7", "display_photo"=>#<ActionD$
App 24927 stderr: ^[[1m^[[36mUser Load (0.2ms)^[[0m ^[[1mSELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1^[[0m
App 24927 stderr: ^[[1m^[[35mCompanyMember Load (0.1ms)^[[0m SELECT `company_members`.* FROM `company_members` WHERE `company_members`.`status` IN (0, 1, 3) AND `company_m$
App 24927 stderr: ^[[1m^[[36mCompany Load (0.1ms)^[[0m ^[[1mSELECT `companies`.* FROM `companies` WHERE 1=0^[[0m
App 24927 stderr: Completed 500 Internal Server Error in 6ms
App 24927 stderr:
App 24927 stderr: Errno::EACCES (Permission denied @ dir_s_mkdir - /var/www/noise/public/uploads/tmp/1422950117-24950-9686):
App 24927 stderr: app/controllers/companies_controller.rb:33:in `create'
App 24927 stderr:
App 24927 stderr:
App 24927 stderr: Rendered /usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.3ms)
App 24927 stderr: Rendered /usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.9ms)
App 24927 stderr: Rendered /usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.9ms)
App 24927 stderr: Rendered /usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (19.1m$
答案 0 :(得分:2)
我们需要授予访问系统 root 用户
所需目录的权限sudo chmod 777 -R your_project_directory_to_be_access
在您的情况下,您可以使用:
sudo chmod 777 -R /var/www/noise/public
出于安全考虑,请记住:
chmod 777
赋予每个人阅读,写作和执行权利,这对于大多数问题来说确实太过分了。