当Capistrano3执行mkdir时,许可被拒绝

时间:2013-12-16 16:14:49

标签: ruby-on-rails capistrano capistrano3

当我bundle exec cap production deploy时,我收到了mkdir: cannot create directory /usr/share/nginx/www/appname/releases/20131216155457: Permission denied

等错误消息

Capistrano3没有set use_sudodefault_run_options。我读到无密码sudo更好,所以我做了visudo username ALL=NOPASSWD:ALL,但我仍然遇到了同样的错误。

set :application, 'appname.com'
set :repo_url, 'git@bitbucket.org:user/myapp.git'
set :user, 'username' 
set :branch, 'master'


set :deploy_to, '/usr/share/nginx/www/appname'
set :keep_releases, 5

namespace :deploy do

 desc 'Restart application'
 task :restart do
   on roles(:app), in: :sequence, wait: 5 do
   end
 end

 after :restart, :clear_cache do
   on roles(:web), in: :groups, limit: 3, wait: 10 do
   end
 end

 after :finishing, 'deploy:cleanup'

end

有没有人就这个问题给我任何建议? 谢谢你的帮助。

2 个答案:

答案 0 :(得分:5)

尝试设置appname文件夹

的组和所有者

chown deployer:www-data -R /usr/share/nginx/www/appname

其中deployer是您的部署用户,而group是用户组

答案 1 :(得分:0)

应该是

chown username:groupname -R /path/to/project