Net::SSH with non unix/linux host?

前端 未结 2 1641
陌清茗
陌清茗 2021-01-23 17:26

I am trying to use the Net::SSH library to login and manage a host that supports ssh. It is a piece of telecom equipment and so speaks TL1. I seem to be able to log in successfu

相关标签:
2条回答
  • 2021-01-23 18:17

    I assume it works fine when you login in the shell manually.

    To understand what is the difference when you connect through net/ssh collect output of env command in both cases and compare.

    That most probably you'll see a difference that will lead you to a solution or at least will give you dirty trick.

    UPDATE. (Not working)

    Net::SSH.start('10.204.121.192', 'password', :password => "password") do |ssh|
       ssh.open_channel do |channel|
            channel.on_data do |ch, data|
              puts "got data: #{data.inspect}"
            end
            channel.send_data("INH-MSG-ALL;\n")
       end
    end
    

    UPDATE2. (Working)

    Net::SSH.start('10.204.121.192', 'password', :password => "password") do |ssh|
       ssh.open_channel do |channel|
            channel.send_channel_request "shell"
            channel.on_data do |ch, data|
              puts "got data: #{data.inspect}"
            end
            channel.send_data("INH-MSG-ALL;\n")
       end
    end
    
    0 讨论(0)
  • 2021-01-23 18:18

    Thanks forker for your updates),

    One more thing,

    from your code how to make this

    puts "got data: #{data.inspect}"
    

    to output data for each command sent to the shell ?

    Does this code wait for each command to complete?

    Thanks.

    0 讨论(0)
提交回复
热议问题