这是我的cgi脚本,我可以使用它来登录ssh1会话但无法从远程会话ssh1登录到另一个会话ssh2。
my $host1=xxx;
my $host2=xxx;
my $user=xxx;
my $pass=xxx;
//two sessions
my $ssh1 = Net::SSH::Perl->new($host1);
my $ssh2 = Net::SSH::Perl->new($host2);
$ssh1->login($user, $pass);
//using this, I am able to login to ssh session1 and execute my commands
$ssh1->cmd($ssh2->login($user, $pass));
//I am unable to login the session2($ssh2) from session1($ssh1)