From: fw Date: 2008-02-19T22:45:14+09:00 Subject: Re: Using net:ssh On Tue, 2008-02-19 at 22:15 +0900, Valerio Schiavoni wrote: > Hello, > what I want to do is the following: > - ssh into a remote machine (let's call it 'frontend') > - from the front-end, ssh into another machine (call it node-A) > > So far, i was only able to perform the first step: > > require 'rubygems' > require 'net/ssh' > > def do_run_introducer(session) > session.open_channel do |channel| > channel.on_data do |ch, data| > puts data > end > channel.exec "ls" #to verify that i'm actually logged in.. > end > end > > Net::SSH.start( 'remote-machine-address', my-user-name' ) do | > session| > do_run_introducer session > #do_run_peers session > session.loop > end > > Any help is very appreciated > Use port forwarding to tunnel a connection through the front end to the SSH port on the node behind it. Then call a second SSH session on the tunneled port. See http://net-ssh.rubyforge.org/chapter-6.html for port forwarding. HTH, Felix