in reply to Re: Howto Access Two Consecutive Hosts with Net::SFTP
in thread Howto Access Two Consecutive Hosts with Net::SFTP
Could you not use NET::SSH::Perl to connect to host1 and the sftp the files form host1 to host2?Can you give small example of how to do it? Sorry I'm really new with NET module here. I couldn't think about how to go about it. Here is what I tried to do..and lost..
Is there a correct way to do it?use Net::SSH::Perl; my $host = 'host1'; my $host2 = 'host2'; my $user = 'edwardwi'; my $pass1 = 'foo'; my $pass2 = 'bar'; # command to do SFTP to host2 # Doesn't seem to work... my $sftp_cmd = Net::SFTP->new($host2, "user" => $user, "password" => $pass2, "debug"=>1) || die 'cannot login $!\n'; my $ssh = Net::SSH::Perl->new($host, port => 22); $ssh->login($user, $pass); # Also how can I call "put/get" command in this context? my ($stdout,$stderr,$exit) = $ssh->cmd($sftp_cmd);
|
|---|