Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Net::SSH2 limitation?

by salva (Canon)
on Jul 30, 2015 at 21:30 UTC ( [id://1136933]=note: print w/replies, xml ) Need Help??


in reply to Net::SSH2 limitation?

Ensure you are using the latest version of libssh2 and try also the version of Net::SSH2 from GutHub as several bugs were fixed there.

In any case, as you seem to be on a Linux/Unix box, consider also using Net::OpenSSH instead.

Replies are listed 'Best First'.
Re^2: Net::SSH2 limitation?
by bbarrette (Initiate) on Jul 31, 2015 at 18:42 UTC
    Thanks for the tip, salva. I am in the process of changing over to OpenSSH now to see if that resolves it. Looks like there is some weirdness happening due to the nature of the remote shell (very proprietary, does not adhere to any known standard of man or beast).
      Update in case anyone else runs into this same problem in the future: I tried porting my code to use Net::OpenSSH but due to the platform I am targeting, I just could not get it working properly. The entire connection would sever and then re-establish and prompt for password after each command. I also had the same issue with Net::SSH::Expect. The solution I came up with was to implement a counter and after 20 iterations, sever the connection cleanly and re-establish for another 20 lines indefinitely. Everything now seems to be in working order. Added code snippet below. Thanks Monks!
      if($i == 20){ print $channel "logout\n"; print "$_" while <$channel>; print "\n"; $channel->send_eof(); $channel->close(); $ssh->disconnect(); undef $ssh; $ssh = Net::SSH2->new(); $ssh->connect($host, 22); $ssh->auth_password($tacacsusername, $tacacspassword); $channel = $ssh->channel(); $channel->blocking(0); $channel->shell(); $i = 0; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1136933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found