in reply to Re^2: Net::SSH2::Channel with exec, reads 0 bytes on suse while works fine on ubuntu
in thread Net::SSH2::Channel with exec, reads 0 bytes on suse while works fine on ubuntu
Regards Charles.— # connect $ssh2->connect($remote_server) or die "\nERROR02 - Unable to connect H +ost $@ \n"; ($code, $error_name, $error_string) = $ssh2->error(); if ($code ne 0) { &log("error001","code = $code"); &log("error002","error_name = $error_name"); &log("error003","error_string = $error_string"); } if ($ssh_pattern eq '/passphrase/') { # authenticate with key and passphrase $ssh2->auth_publickey($remote_login, $pub_key_file, $priv_key_file +, $remote_password) or die "\nERROR03 Unable to login $@ \n"; ($code, $error_name, $error_string) = $ssh2->error(); if ($code ne 0) { &log("error011","code = $code"); &log("error012","error_name = $error_name"); &log("error013","error_string = $error_string"); } } else { # authenticate with user and password $ssh2->auth_password($remote_login,$remote_password) or die "\nERR +OR04 Unable to login $@ \n"; ($code, $error_name, $error_string) = $ssh2->error(); if ($code ne 0) { &log("error021","code = $code"); &log("error022","error_name = $error_name"); &log("error023","error_string = $error_string"); } } # DE-Block SSH2 for channel open (blocking to 1) $ssh2->blocking(1); # open channel 1 $chan1 = $ssh2->channel(); ($code, $error_name, $error_string) = $ssh2->error(); if ($code ne 0) { &log("error031","code = $code"); &log("error032","error_name = $error_name"); &log("error033","error_string = $error_string"); } # Block SSH2 for channel shell (blocking to 0) $ssh2->blocking(0); ($code, $error_name, $error_string) = $ssh2->error(); if ($code ne 0) { &log("error051","code = $code"); &log("error052","error_name = $error_name"); &log("error053","error_string = $error_string"); } # start channel shell $chan1->shell(); # send a CR to initialize the session print $chan1 "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Net::SSH2::Channel with exec, reads 0 bytes on suse while works fine on ubuntu
by howheels (Initiate) on Nov 11, 2011 at 00:06 UTC |