我尝试推送到生产环境时遇到的问题是此错误:部署失败并出现错误:
#<Net::SSH::AuthenticationFailed: ec2-user>
我已经尝试了很多Stackoverflow解决方案,但无济于事。我的deploy.rb是
set :user, 'ec2-user'
set :application, 'name of application on git'
set :repo_url, 'the url from my remote origin to git'
set :deploy_to, 'where my apache points but minus the /public'
我的production.rb是
role :app, %w{ip}
role :web, %w{ip} (same as above)
role :db, %w{ip}
set :ssh_options, {
user: "ec2-user",
keys: %w(location to .pem file that I use to ssh in on),
forward_agent: false,
}
我曾尝试为两者创建新密钥并使用此处概述的密钥http://craiccomputing.blogspot.com/2008/08/ec2-ssh-and-capistrano.html cap使用admin而不是ec2-user
但是仍然没有骰子。
有什么想法吗?
您可以检查/home/ec2-user/.ssh
目录和`/home/ec2-user/.ssh/authorized_keys文件的权限。它们应该是这样的:
ec2-user@ec2-server:~/.ssh$ ls -la
total 24
drwx------ 2 ec2-user ec2-user 4096 Jan 31 00:39 .
drwx------ 5 root root 4096 Jan 31 21:59 ..
-rw------- 1 ec2-user ec2-user 731 Jan 31 20:39 authorized_keys
-r-------- 1 ec2-user ec2-user 3243 Jan 31 20:39 id_rsa
-r-------- 1 ec2-user ec2-user 731 Jan 31 20:39 id_rsa.pub
-rw------- 1 ec2-user ec2-user 1976 Jan 31 20:39 known_hosts
您也可以尝试以其他用户身份进行部署。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句