Colin Wu
Colin Wu

Reputation: 699

Capistrano deploy used to work but now getting authentication failure

I know this probably looks like a repeat of this question, but believe me, this is slightly different.

I have been using Capistrano to deploy a Rails app for several years now, but as of last week I started getting an "Authentication Failure" error. From a shell I am able to ssh to the deployment server and execute commands, and nothing has changed in my capistrano configuration (I am the only one with access.)

The traceback says it is Net::SSH that's raising the exception, so I did a small test with Net::SSH module and it is indeed failing.

%> irb

require "net/ssh"
Net::SSH.start("remote.host.name", "my_username", auth_methods: %w[publickey], keys: %[/home/path_to/id.rsa]) do |ssh|
  content = ssh.exec!("ls -l")
  puts content
end

And what I get back is:

Traceback (most recent call last):
    2: from (irb):5
    1: from (irb):6:in `rescue in irb_binding'
Net::SSH::AuthenticationFailed (Authentication failed for user [email protected])

Has anything changed with Net::SSH or Capistrano? I am using the latest version of each.

Upvotes: 1

Views: 766

Answers (1)

moonosign
moonosign

Reputation: 31

Run into the same issue, thanks to your irb snippet found a solution:) It works fine with net-ssh 7.0.1, but capistrano (sshkit->net-scp) depends on net-ssh < 7.0.0 so you need to update it too.

gem uninstall net-ssh # remove 6.x version
gem install net-ssh # install last one, 7.0.1 in my case
gem uninstall net-scp
gem install net-scp -v 4.0.0.rc1 # this version just bumps net-ssh dependency to < 8.0.0

I connect to Ubuntu 22.04 host, and this release migrates to openssl3, I guess it's the issue with net-ssh lib.

Upvotes: 1

Related Questions