eval "
use IO::Handle;
use Net::SSH::Perl;
use Net::SSH::Perl::Cipher;
use utf8;
";
die $@ if $@;
$port = 22 if ($port eq "");
$ssh = Net::SSH::Perl->new(
$host,
"port" => $port,
"protocol" => 1,
"debug" => 1,
);
utf8::encode( $login );
utf8::encode( $password );
utf8::encode( $command );
print( $host.":".$port." ".$login." ".$password." ".$command."<br/>\n" );
$ssh->login($login, $password);
my ($out, $err) = $ssh->cmd($command);
print "out:".$out."\nerr: ".$err."\n";
@output = split (/\n/, $out);
exit;
Perl SSH проблемы с соединением
Через консольку получается залезть к нему.
А вот из Perl программы не приходит никакого ответа. Почему не понять.
Используется Perl 5.8.8, CentOS.
Кусок кода:
Код:
В логах выводятся различные сообщения (это все от момента старта куска кода и до таймаута, XXX скрыты уникальные данные для проекта):
Код:
[XXX] [error] [client XXX] XXX: Reading configuration data ./.ssh/config, referer: XXX
[XXX] [error] [client XXX] XXX: Reading configuration data /etc/ssh_config, referer: XXX
[XXX] [error] [client XXX] XXX: Connecting to XXX, port 22., referer: XXX
[XXX] [error] [client XXX] XXX: Remote version string: SSH-1.99-OpenSSH_4.4, referer: XXX
[XXX] [error] [client XXX] , referer: XXX
[XXX] [error] [client XXX] XXX: Remote protocol version 1.99, remote software version OpenSSH_4.4, referer: XXX
[XXX] [error] [client XXX] XXX: Net::SSH::Perl Version 1.30, protocol version 1.5., referer: XXX
[XXX] [error] [client XXX] XXX: No compat match: OpenSSH_4.4., referer: XXX
[XXX] [error] [client XXX] XXX: Connection established., referer: XXX
[XXX] [error] [client XXX] XXX: Waiting for server public key., referer: XXX
[XXX] [error] [client XXX] XXX: Received server public key (768 bits) and host key (1024 bits)., referer: XXX
[XXX] [error] [client XXX] XXX: Host 'XXX' is known and matches the host key., referer: XXX
[XXX] [error] [client XXX] XXX: Encryption type: DES3, referer: XXX
[XXX] [error] [client XXX] XXX: Sent encrypted session key., referer: XXX
[XXX] [error] [client XXX] XXX: Received encryption confirmation., referer: XXX
[XXX] [error] [client XXX] XXX: RSA authentication failed: Can't load public key., referer: XXX
[XXX] [error] [client XXX] XXX: Doing challenge response authentication., referer: XXX
[XXX] [error] [client XXX] XXX: No challenge presented., referer: XXX
[XXX] [error] [client XXX] XXX: Trying password authentication., referer: XXX
[XXX] [error] [client XXX] XXX: Sending command: ping XXX, referer: XXX
[XXX] [error] [client XXX] XXX: Entering interactive session., referer: XXX
[XXX] [warn] [client XXX] Timeout waiting for output from CGI script XXX, referer: XXX
[XXX] [error] [client XXX] (70007)The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed, referer: XXX
[XXX] [error] [client XXX] XXX: Reading configuration data /etc/ssh_config, referer: XXX
[XXX] [error] [client XXX] XXX: Connecting to XXX, port 22., referer: XXX
[XXX] [error] [client XXX] XXX: Remote version string: SSH-1.99-OpenSSH_4.4, referer: XXX
[XXX] [error] [client XXX] , referer: XXX
[XXX] [error] [client XXX] XXX: Remote protocol version 1.99, remote software version OpenSSH_4.4, referer: XXX
[XXX] [error] [client XXX] XXX: Net::SSH::Perl Version 1.30, protocol version 1.5., referer: XXX
[XXX] [error] [client XXX] XXX: No compat match: OpenSSH_4.4., referer: XXX
[XXX] [error] [client XXX] XXX: Connection established., referer: XXX
[XXX] [error] [client XXX] XXX: Waiting for server public key., referer: XXX
[XXX] [error] [client XXX] XXX: Received server public key (768 bits) and host key (1024 bits)., referer: XXX
[XXX] [error] [client XXX] XXX: Host 'XXX' is known and matches the host key., referer: XXX
[XXX] [error] [client XXX] XXX: Encryption type: DES3, referer: XXX
[XXX] [error] [client XXX] XXX: Sent encrypted session key., referer: XXX
[XXX] [error] [client XXX] XXX: Received encryption confirmation., referer: XXX
[XXX] [error] [client XXX] XXX: RSA authentication failed: Can't load public key., referer: XXX
[XXX] [error] [client XXX] XXX: Doing challenge response authentication., referer: XXX
[XXX] [error] [client XXX] XXX: No challenge presented., referer: XXX
[XXX] [error] [client XXX] XXX: Trying password authentication., referer: XXX
[XXX] [error] [client XXX] XXX: Sending command: ping XXX, referer: XXX
[XXX] [error] [client XXX] XXX: Entering interactive session., referer: XXX
[XXX] [warn] [client XXX] Timeout waiting for output from CGI script XXX, referer: XXX
[XXX] [error] [client XXX] (70007)The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed, referer: XXX
Кто-нибдуь сталкивался с такой проблемой?
Как ее решить?
Найти решение не удалось, поэтому пишу сюда.
Код:
$ssh = Net::SSH::Perl->new(
$host,
"port" => $port,
"protocol" => 1,
"debug" => 1,
options => [ "BatchMode no" ]
);
$host,
"port" => $port,
"protocol" => 1,
"debug" => 1,
options => [ "BatchMode no" ]
);