检查SSH

  
  require 'net/ssh'

  def test_ssh_connect(address,username,password)
    begin
      Net::SSH.start(address, username, :password => password)   
    rescue Exception => e  
      logger.info('verify ssh failed:'+e.to_s)
      return true
    end  
    return false
  end 

编程技巧