in reply to Re: How to open nested SSH connection using perl
in thread How to open nested SSH connection using perl

Thanks thanos1983 With the help of the link you have given i started the port forwarding and tunneling process in the background and now I am able to do the SSH to host 2 in the script. thanks --girija
  • Comment on Re^2: How to open nested SSH connection using perl

Replies are listed 'Best First'.
Re^3: How to open nested SSH connection using perl
by salva (Canon) on Jul 13, 2015 at 08:33 UTC
    And so, port forwarding is enabled in the gateway server...
    use Net::OpenSSH; my $sshA = Net::OpenSSH->new($serverA, user => $userA, password => $passwordA); my $proxy_command = $sshA->make_remote_command({tunnel => 1}, $serverB +, 22); my $sshB = Net::OpenSSH->new($serverB, user => $userB, password => $passwordB, proxy_command => $proxy_command); $sshB->system($cmd1); $sshB->system($cmd2); ...
        That means your version of the SSH client is too old and doesn't support the -W feature.

        Your current solution is not very elegant because others may be able to use the tunnels you are creating to get to serverB without login into serverA first.

      I am getting an error with this code -w option is not known option then we try to do

      my $sshB = Net::OpenSSH->new($serverB, user => $userB, password => $passwordB, proxy_command => $proxy_command);

        is socat or netcat or some similar program installed on serverA?