Capstrano Rails 6-Net::SSH用户部署身份验证失败(SSHKit::Runner::ExecuteError)

wfveoks0  于 2022-09-20  发布在  Nginx
关注(0)|答案(0)|浏览(108)

我正在尝试使用Capstrano在AWS EC2示例中部署我的rails 6应用程序。

1.我创建了一个名为‘Deploy’的用户

2.我将本地的RD_rsa.pub添加到服务器的~/.ssh/授权密钥中

*3.net-ssh版本6.1.0

输出量

/home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/backends/connection_pool.rb:63:in `call': Passing nil, or [nil] to Net::SSH.start is deprecated for keys: user.....
Mechanism 'publickey','password' was requested, but isn't a known type.  Ignoring it.
E, [2022-04-26T17:02:12.656111 #27306] ERROR -- net.ssh.authentication.session[4e84]: all authorization methods failed (tried 'publickey','password')

# <Thread:0x000055d61c59fec8 /home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):

Traceback (most recent call last):
    12: from /home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'....
.../home/vijay/.rvm/gems/ruby-2.7.3/gems/net-ssh-6.1.0/lib/net/ssh.rb:268:in `start': Authentication failed for user deploy@65.0.135.220 (Net::SSH::AuthenticationFailed)
    1: from /home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@65.0.135.220: Authentication failed for user deploy@65.0.135.220 (SSHKit::Runner::ExecuteError)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@65.0.135.220: Authentication failed for user deploy@65.0.135.220
/home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'

Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user deploy@65.0.135.220
/home/vijay/.rvm/gems/ruby-2.7.3/gems/net-ssh-6.1.0/lib/net/ssh.rb:268:in `start'
/home/vijay/.rvm/gems/ruby-2.7.3/gems/sshkit-
Tasks: TOP => rvm:hook => passenger:rvm:hook => passenger:test_which_passenger

CapFILE

require "capistrano/setup"

# Include default deployment tasks

require "capistrano/deploy"

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require "capistrano/rvm"
require "capistrano/rbenv"

# require "capistrano/chruby"

require "capistrano/bundler"
require "capistrano/rails/assets"

# require "capistrano/rails/migrations"

require "capistrano/passenger"
require "capistrano/puma"
require 'sshkit/sudo'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

require 'capistrano/puma'
install_plugin Capistrano::Puma  # Default puma tasks
install_plugin Capistrano::Puma::Workers  # if you want to control the workers (in cluster mode)
install_plugin Capistrano::Puma::Jungle # if you need the jungle tasks
install_plugin Capistrano::Puma::Monit  # if you need the monit tasks
install_plugin Capistrano::Puma::Nginx

部署/生产.rb

server '65.0.135.220', user: 'deploy', roles: %w{web app db}

Deploy.rb

lock "~> 3.17.0"

set :application, 'travel_empire'
set :repo_url, 'git@github.com:vijayendran91/travel_empire.git' # Edit this to match your repository
set :branch, :master
set :deploy_to, '/home/deploy/travel_empire'
set :ssh_options, {:verbose => :debug, forward_agent: true, auth_methods: %w['publickey','password'], user: fetch(:user), keys: %w(~/.ssh/travel_empire.pem) }
set :bundle_flags, "--deployment"

# set :ssh_options, { forward_agent: true, user: fetch(:user), keys: path_to_pem_key }

......

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题