http://www.perlmonks.org?node_id=688878


in reply to Net::SSH2 Question - again-

You can use ssh's port forwarding to do this:

use strict; use Net::SSH2; my $ssh1 = Net::SSH2->new(); $ssh1->connect($host1) or die "connect to SSH1 failed"; $ssh1->auth_password('user', 'pass') or die "auth1 failed"; $ssh1->tcpip($host2, 22, '127.0.0.1', 9922); my $ssh2 = Net::SSH2->new(); $ssh2->connect('127.0.0.1', 9922) or die "connect to SSH2 failed"; $ssh2->auth_password('user2', 'pass2') or die "auth2 failed"; # ... as many hops as you need ...

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: Net::SSH2 Question - again-
by bgi (Sexton) on May 29, 2008 at 15:47 UTC
    Its not working for me...after a few tests i can say, that it dont understand what to do with this line:

    $ssh2->connect('127.0.0.1', 9922) or die "connect to SSH2 failed";
      this line is not working!! no idea why...i tested the other lines with if(-command-){print "ok";} and every line prints its "ok" expect the given line with tcpip