Topic: Issue with Net::SSH

Hi All,

I am trying to play around with SSH using which I am using to automate my process.. Dont curse me if this is quite straight forward, am quite a noob here
The idea is that I need to connect to a remote server and from there connect to the various machines and execute my commands there. I am able to login to the remove server successfully but moving from there to other machines is an issue..
For eg. I connect to remote server which which is a jumpstation.. From this I can move to other machines to execute my code there.. This works correctly using SSH Client with Bash commands

Below is the code

require 'rubygems'
require 'net/ssh'

password = "xyz"
def Login(password)
    puts "Inside Login"
    puts password
    Net::SSH.start('host', 'username', :password => password) do |ssh|
      # capture all stderr and stdout output from a remote process
      output = ssh.exec!("host")
      puts "Connection Established"
      return ssh
    end
end
ssh = Login(password)
begin
puts ssh.exec!("ssh user@otherhost")
rescue
  puts "Rescued"
end
exit
 

This prints "ssh: shell login on secondary not allowed in batch mode".  Can anybody kindly guide me as how should have a go at this.
Thanks for the Help smile