【问题标题】:Authentication failed for user Net::SSH::AuthenticationFailed用户 Net::SSH::AuthenticationFailed 的身份验证失败
【发布时间】:2018-01-03 20:52:52
【问题描述】:

我正在尝试将我的应用程序部署到 ubuntu 服务器,但出现错误。我已在服务器授权密钥中添加了我的密钥。我将 Google 计算机服务器用于服务器目的。我无法找到任何解决方案,所有解决方案都导致服务器 ssh 文件夹中的授权密钥,我已经添加了它。有没有人面临同样的问题?这是一个代码:

Ayazs-MBP:peatio_exchange ayaz$ cap production deploy
00:00 rbenv:validate
      rbenv: rbenv_ruby is not set; ruby version will be defined by the remote …
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@35.190.186.40: Authentication failed for user deploy@35.190.186.40


Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user deploy@35.190.186.40

Tasks: TOP => rbenv:map_bins => passenger:rbenv:hook => passenger:test_which_passenger
(See full trace by running task with --trace)
Ayazs-MBP:peatio_exchange ayaz$ 

我的宝石是

group :development do
    gem 'capistrano',         require: false
    gem 'capistrano-rvm',     require: false
    gem 'capistrano-rails',   require: false
    gem 'capistrano-bundler', require: false
    gem 'capistrano3-puma',   require: false
    gem 'capistrano-passenger'
    gem 'capistrano-rbenv', '~> 2.0', require: false
  end

cap 文件是

# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#   https://github.com/capistrano/passenger
#
require "capistrano/rails"
# require "capistrano/rvm"
require "capistrano/rbenv"
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require "capistrano/passenger"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

部署.rb

lock "~> 3.10.1"

set :application, "peatio_exchange"
set :repo_url, "https://github.com/ayazahmadtarar/peatio_exchange.git"

生产.rb

server "35.190.186.40",
  user: "deploy",
  roles: %w{web app},
  ssh_options: {
    user: "deploy", # overrides user setting above
    keys: %w(/home/deploy/.ssh/id_rsa),
    forward_agent: false,
    auth_methods: %w(publickey password)
    # password: "please use keys"
  }

【问题讨论】:

    标签: ruby-on-rails ruby deployment capistrano passenger


    【解决方案1】:

    这可能是很多事情,但从外观上看,您可能添加的公钥不适合deploy 用户。确保它存在于/home/deploy/.ssh(或其主目录中)

    确保您能够使用ssh deploy@35.190.186.40 登录到服务器——如果您为部署用户生成了单独的密钥,您可以使用-i 标志来指定密钥文件的路径。

    ssh -i ~/Desktop/deploy_id_rsa.pub deploy@35.190.186.40

    【讨论】:

      猜你喜欢
      • 2017-05-13
      • 2015-02-01
      • 2015-05-04
      • 2016-08-29
      • 2016-02-27
      • 2017-05-15
      • 1970-01-01
      • 2014-05-20
      • 2017-01-03
      相关资源
      最近更新 更多