首页 > 解决方案 > 如何从 net.ssh.authentication Ruby 获取更详细的错误消息

问题描述

我正在尝试查看来自 SSH 服务器的详细错误消息

我有的:

require 'rubygems' require 'net/ssh' require 'sshkey'

k = SSHKey.generate( type: "RSA", bits: 2048 ) begin Net::SSH.start("x.x.x.x","username", :keys=>[k.public_key], :verbose => Logger::DEBUG, :auth_methods => ['publickey']) do |ssh| end rescue SocketError puts "Host name cannot be resolved." strBypass = true rescue Net::SSH::AuthenticationFailed puts " Authentication failure" end

我特别在寻找来自 ssh 服务器的“SSH2_MSG_USERAUTH_FAILURE”响应。

请帮忙

标签: rubyssh

解决方案


推荐阅读