Perl SSH2 not working. Double login required.

P

piotr.snarski

Hi Guys,

I'm trying to log into network device using SSH. Below code works perfectlyfor CISCO devices and others. However, to log into a PacketShaper device I'm prompted to insert login twice and in that case below code it not working. Using putty I'm getting such prompts:

login as: #here I just hit eneter
login: # actual username
passowrd: #pass

Do you have any ideas how to force it to work with double login prompts?


#!/usr/bin/perl -w
use strict;
use Net::SSH2;


my $ssh2 = Net::SSH2->new();
$ssh2->debug(1);
$ssh2->connect("host") or die "Unable to connect host $@ \n";
$ssh2->auth_password('admin','password');
my $chan = $ssh2->channel();
$chan->exec('date');
my $buflen = 10000;
my $buf1 = '0' x $buflen;
$chan->read($buf1, $buflen);
print "BUF1:\n", $buf1,"\n";
$chan->exec('exit');
$ssh2->disconnect();
 
R

Rainer Weikusat

I'm trying to log into network device using SSH. Below code works perfectly for CISCO devices and others. However, to log into a PacketShaper device I'm prompted to insert login twice and in that case below code it not working. Using putty I'm getting such prompts:

login as: #here I just hit eneter
login: # actual username
passowrd: #pass

Do you have any ideas how to force it to work with double login
prompts?

I know 'login as' as putty "before login" prompt and it can be used to
enter a username. The 'system login prompt' than shouldn't appear
anymore.
 
P

piotr.snarski

Thanks for that.

The thing is I'd like to code it with perl somehow.. I mean login to PacketShaper automatically... Is anybody aware how to rebuild the script and achieve the goal ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top