Ask a Question related to PERL Modules, Design and Development.
-
new bee #1
Net::SSH::Perl dies during logon only when username is entered in stdin
Hi, could anyone please help me with this?
I am writing a script that would ssh to a remote computer and execute
commands,
but mine does not get past the logon. Here is my code:
my %args;
$args{protocol} = '2';
$args{debug} = 1;
my @hosts = ("127.0.0.1");
#my $user = "testuser";
my $oldpass = 'xxx';
print "Please enter your username: ";
my $user = <STDIN>;
chomp $user;
foreach my $host (@hosts)
{
my $ssh = Net::SSH::Perl->new($host, %args);
$ssh->login($username5, $oldpass);
....}
This sript dies, with these debug statements:
"acs-114-24.barnard.columbia.edu: Sent key-exchange init (KEXINIT),
wait response.
acs-114-24.barnard.columbia.edu: Algorithms, c->s: 3des-cbc hmac-sha1
none
acs-114-24.barnard.columbia.edu: Algorithms, s->c: 3des-cbc hmac-sha1
none
acs-114-24.barnard.columbia.edu: Entering Diffie-Hellman Group 1 key
exchange.
acs-114-24.barnard.columbia.edu: Sent DH public key, waiting for
reply.
acs-114-24.barnard.columbia.edu: Received host key, type 'ssh-dss'.
acs-114-24.barnard.columbia.edu: Host '127.0.0.1' is known and matches
the host key.
acs-114-24.barnard.columbia.edu: Computing shared secret key.
acs-114-24.barnard.columbia.edu: Verifying server signature.
acs-114-24.barnard.columbia.edu: Waiting for NEWKEYS message.
acs-114-24.barnard.columbia.edu: Enabling incoming
encryption/MAC/compression.
acs-114-24.barnard.columbia.edu: Send NEWKEYS, enable outgoing
encryption/MAC/compression.
acs-114-24.barnard.columbia.edu: Sending request for
user-authentication service.
acs-114-24.barnard.columbia.edu: Service accepted: ssh-userauth.
acs-114-24.barnard.columbia.edu: Trying empty user-authentication
request.
input must be 8 bytes long at
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm
line 59."
However, if instead of prompting the user to enter the username, I
simply do
$user = "testuser"
then there is no problem and I can login just fine.
The problem probably lies with input from stdin not being exactly the
same as 'testuser', but I print the input out just before sending it
to login, and it prints 'testuser'. Does anyone have any ideas that
may help me?
Thank you so much,
Michael
new bee Guest
-
Show username after login | Example: Welcome "USERNAME"to your Backoffice.
hi. I've created a backoffice in php, and i would like to apply on the page the name of the user who has just logged in. Example: Welcome... -
'unpipe' STDIN
Hi - I have a perl 'filter' script that relies on piped input from STDIN, i.e.: find /etc/ | ./myfilter.pl etc... I have a need to interact... -
fflush stdin
hello all, Quick question How do I flush stdin. I am writing an interactive console based script And I want that all inputs received before my... -
<STDIN>
In my script iam using the following line.. ..... where the user has to keyin either of the options 1)"Change_Request", 2)"call_req" 3)"Both" ... -
STDIN
use Time::Local; use FileHandle; my @month_list = qw/ January February March April May June July August September October November December /;... -
Jim Keenan #2
Re: Net::SSH::Perl dies during logon only when username is enteredin stdin
new bee wrote:
Where does $username5 come from? Shouldn't it have been $user?> Hi, could anyone please help me with this?
>
> I am writing a script that would ssh to a remote computer and execute
> commands,
> but mine does not get past the logon. Here is my code:
>
> my %args;
> $args{protocol} = '2';
> $args{debug} = 1;
>
> my @hosts = ("127.0.0.1");
>
> #my $user = "testuser";
> my $oldpass = 'xxx';
>
> print "Please enter your username: ";
> my $user = <STDIN>;
> chomp $user;
>
> foreach my $host (@hosts)
> {
> my $ssh = Net::SSH::Perl->new($host, %args);
>
> $ssh->login($username5, $oldpass);
Jim Keenan Guest
-
___cliff rayman___ #3
Re: Net::SSH::Perl dies during logon only when username is enteredin stdin
see lots of comments inline, all the way down to the bottom.
new bee wrote:
use warnings;>Hi, could anyone please help me with this?
>
>I am writing a script that would ssh to a remote computer and execute
>commands,
>but mine does not get past the logon. Here is my code:
>
use strict;
# the above two lines will tell you what the problem is. use them in
all of your programs.
an error would be reported here if you had used: "use strict".>
>my %args;
>$args{protocol} = '2';
>$args{debug} = 1;
>
>my @hosts = ("127.0.0.1");
>
>#my $user = "testuser";
>my $oldpass = 'xxx';
>
>print "Please enter your username: ";
>my $user = <STDIN>;
>chomp $user;
>
>foreach my $host (@hosts)
>{
> my $ssh = Net::SSH::Perl->new($host, %args);
>
> $ssh->login($username5, $oldpass);
>
here is an error message that further gives a hint about what the>...}
>
>This sript dies, with these debug statements:
>"acs-114-24.barnard.columbia.edu: Sent key-exchange init (KEXINIT),
>wait response.
>acs-114-24.barnard.columbia.edu: Algorithms, c->s: 3des-cbc hmac-sha1
>none
>acs-114-24.barnard.columbia.edu: Algorithms, s->c: 3des-cbc hmac-sha1
>none
>acs-114-24.barnard.columbia.edu: Entering Diffie-Hellman Group 1 key
>exchange.
>acs-114-24.barnard.columbia.edu: Sent DH public key, waiting for
>reply.
>acs-114-24.barnard.columbia.edu: Received host key, type 'ssh-dss'.
>acs-114-24.barnard.columbia.edu: Host '127.0.0.1' is known and matches
>the host key.
>acs-114-24.barnard.columbia.edu: Computing shared secret key.
>acs-114-24.barnard.columbia.edu: Verifying server signature.
>acs-114-24.barnard.columbia.edu: Waiting for NEWKEYS message.
>acs-114-24.barnard.columbia.edu: Enabling incoming
>encryption/MAC/compression.
>acs-114-24.barnard.columbia.edu: Send NEWKEYS, enable outgoing
>encryption/MAC/compression.
>acs-114-24.barnard.columbia.edu: Sending request for
>user-authentication service.
>acs-114-24.barnard.columbia.edu: Service accepted: ssh-userauth.
>acs-114-24.barnard.columbia.edu: Trying empty user-authentication
>request.
>
problem is.
-->input must be 8 bytes long at
>/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm
>line 59."
>
>
_____cliff_rayman_____cliff_@_rayman_._com_____
___cliff rayman___ Guest
-
Keith #4
Re: Net::SSH::Perl dies during logon only when username is entered in stdin
I ran into this a long time ago....I think it has something to do with the encoding of the text. You need to convert from one format to another -- Unicode has something to do with it. There's a Perl package somewhere that takes care of it.
Keith Guest



Reply With Quote

