【问题标题】:Capistrano 3 + AWS: Deployment IssuesCapistrano 3 + AWS:部署问题
【发布时间】:2014-02-24 17:36:48
【问题描述】:

当我尝试推送到生产环境时,我遇到的问题是这个错误: 部署失败并出现错误:

#<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 uses admin instead of ec2-user

但还是没有骰子。

想法?

【问题讨论】:

  • 你能在this 上指导我吗?
  • 你能创建一个stackoverflow帖子吗?你试过什么,它是怎么失败的?这篇文章和引用的另一篇文章都有明确的步骤来尝试解决这些问题;你拿走了吗?

标签: ruby-on-rails amazon-web-services amazon-ec2 ssh-keys


【解决方案1】:

您可以检查/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

您也可以尝试以其他用户身份进行部署。

【讨论】:

  • 这是我的问题——我的授权密钥允许组和其他用户读/写。执行chmod 600 ~/.ssh/authorized_keys 使其开始工作。
【解决方案2】:

我是愚蠢的;我为我的 Rails ec2 提供了 .pem,但没有为我的 DB ec2 提供。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-07
    • 2014-05-30
    • 1970-01-01
    • 1970-01-01
    • 2011-05-15
    • 1970-01-01
    相关资源
    最近更新 更多