BananaJoe has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I am pretty new to perl and try to establish a SSH connection with the module Net::SSH::Perl.

When debugging the SSH setup I get the following error:

localhost.localdomain: Reading configuration data /root/.ssh/config localhost.localdomain: Reading configuration data /etc/ssh_config localhost.localdomain: Allocated local port 1023. localhost.localdomain: Connecting to 10.10.10.203, port 22. localhost.localdomain: Remote protocol version 1.99, remote software v +ersion OpenSSH_3.5p1 localhost.localdomain: Net::SSH::Perl Version 1.23, protocol version 2 +.0. localhost.localdomain: No compat match: OpenSSH_3.5p1. localhost.localdomain: Connection established. localhost.localdomain: Sent key-exchange init (KEXINIT), wait response +. localhost.localdomain: Algorithms, c->s: 3des-cbc hmac-sha1 none localhost.localdomain: Algorithms, s->c: 3des-cbc hmac-sha1 none localhost.localdomain: Entering Diffie-Hellman Group 1 key exchange. localhost.localdomain: Sent DH public key, waiting for reply. localhost.localdomain: Received host key, type 'ssh-dss'. localhost.localdomain: Host '10.10.10.203' is known and matches the ho +st key. localhost.localdomain: Computing shared secret key. localhost.localdomain: Verifying server signature. localhost.localdomain: Waiting for NEWKEYS message. localhost.localdomain: Enabling incoming encryption/MAC/compression. localhost.localdomain: Send NEWKEYS, enable outgoing encryption/MAC/co +mpression. localhost.localdomain: Sending request for user-authentication service +. localhost.localdomain: Service accepted: ssh-userauth. localhost.localdomain: Trying empty user-authentication request. input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.0/i386-linu +x-thread-multi/Crypt/DES.pm line 57.
my script calls the SSH in the following way:
print "Enter your username: "; chomp(my $user = <STDIN>); print "Enter your pass on that host: "; chomp(my $user = <STDIN>); my $ssh = Net::SSH::Perl->new($ip,protocol => '2', cipher => '3des-cbc +', debug =>'1', interactive => '1'); $ssh->login($user,$pass); ... etc.
Any Idea where the error comes from ?

Looking forward to hearing any ideas ...

Markus

20030714 Edit by Corion: Added CODE tags

Replies are listed 'Best First'.
Re: Input Type Error when setting up a SSH connection with Net::SSH::Perl
by antirice (Priest) on Jul 14, 2003 at 08:27 UTC

    It'd help if you set $pass. You can avoid these types of errors with use strict;.

    use strict; ... print "Enter your username: "; chomp(my $user = <STDIN>); print "Enter your pass on that host: "; chomp(my $pass = <STDIN>); ...

    Hope this helps.

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1

      When using "use strict":
      How do I use the variables then ?
      I need to use "the explicit package name"... what is it for my global variables?!?

      Not using strict but cleartext passwords - hardcoded:
      When setting the $pass to a fixed value I can login but
      afterwards when executing any command with

      $ssh->cmd($command)

      I get the same error - it looks to me like the values read in from the STDIN are not crypted in the right way.
      Is there any possibility to solve this problem ?

      Thangs again


      Mark
      When using "use strict":
      How do I use the variables then ?
      I need to use "the explicit package name"... what is it for my global variables?!?

      Not using strict but cleartext passwords - hardcoded:
      When setting the $pass to a fixed value I can login but
      afterwards when executing any command with

      $ssh->cmd($command)

      I get the same error - it looks to me like the values read in from the STDIN are not crypted in the right way.
      Is there any possibility to solve this problem ?

      Thangs again


      Mark