如何从net.ssh.authentication Ruby获取更多详细的错误消息

时间:2018-08-24 21:48:04

标签: ruby ssh

我正在尝试查看来自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”响应。

请帮助

0 个答案:

没有答案