用户Net :: SSH :: AuthenticationFailed的身份验证失败

时间:2018-01-03 20:52:53

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

我正在尝试将我的应用程序部署到ubuntu服务器,但我收到错误。我已经在服务器授权密钥中添加了我的密钥。我使用谷歌计算机服务器用于服务器目的。我无法找到任何解决方案所有解决方案导致服务器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

上限文件是

# 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 }

Deploy.rb

lock "~> 3.10.1"

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

Production.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"
  }

1 个答案:

答案 0 :(得分:1)

这可能是一些事情,但从它的外观来看,你可能添加的公钥对于deploy用户来说并非如此。确保它存在于/home/deploy/.ssh(或其主目录中)

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

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