Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Net::OpenSSH to ups appliance

by salva (Abbot)
on Aug 29, 2013 at 12:18 UTC ( #1051417=note: print w/replies, xml ) Need Help??

in reply to Net::OpenSSH to ups appliance

The SSH implementation on that device seems crippled. It doesn't perform authentication using the SSH protocol. Instead it asks for the password when a shell is started on some SSH channel.

Net::OpenSSH will not handle authenticating against such systems. Though, if all you want is getting the motd, the following code may work:

my $ssh = Net::OpenSSH->new($host, user => $user, timeout => 30); my $motd = $ssh->capture({stdin_data => "$password\n\n4\n", stderr_to_stdout => 1}); print $motd;

Alternatively, just use Expect.

Replies are listed 'Best First'.
Re^2: Net::OpenSSH to ups appliance
by natxo (Beadle) on Aug 29, 2013 at 13:45 UTC
    Thanks for the tip. This is what is working for me now:
    my $ssh = Net::OpenSSH->new( $host, user => "user", password => "password", timeout => 30, ); my $motd = $ssh->capture( { stderr_to_stdout => 1, } ); print $motd;
    The devices are indeed crippled, and unfortunately we need to resort to this kind of stuff to know when they break.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051417]
[choroba]: Progress! Nowadays, you can write a Perl script to generate such an anagram!
[GotToBTru]: i like to order my chemicals a-la-carte ambrus ;)
[thepkd]: Hi, in trying to create an Array of Hash of Array of Hash. You read it right. Is it possible to dereference it without using temps?
[GotToBTru]: what are temps?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2016-12-06 13:12 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.