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

Trying to get a simple perl program using Net:SSH:Perl module work on Sun Solaris 5.8 Going from Solaris 5.8 to Solaris 2.8 machine. code snippet below
#!/apps/perl/bin/perl use Net::SSH::Perl ; chomp(my $this_host = `hostname`); print "Enter host name : [$this_host] "; chomp(my $host = <STDIN>); print "\n"; my $this_user = scalar getpwuid($<); print "Enter your username : [$this_user] "; chomp(my $user = <STDIN>); print "And your password: "; chomp(my $pass =<STDIN>); $scon = Net::SSH::Perl->new ($host || $this_host, protocol => 2, debug + => 1); $scon->login($user || $this_user,$pass); print "looking around ...\n"; my($output,$errors,$exit) = $scon->cmd("ls -l"); print "output:$output|\n"; print "errors:$errors|\n"; print "exit:$exit|\n";
in mutiple runs that we did, it just drops/quits exactly at the same point... sample output and the tail end of the 'truss' output of the program is shown....any advise from the experts in solving this problem will be great....
Enter a host name to connect to: [abc123] xyz123 Enter your username on that host: [login12] login12 And your password: log123 abc123: Reading configuration data /home/dba/.ssh/config abc123: Reading configuration data /etc/ssh_config abc123: Connecting to xyz123, port 22. abc123: Remote version string: SSH-2.0-OpenSSH_4.1 abc123: Remote protocol version 2.0, remote software version OpenSSH_4 +.1 abc123: Net::SSH::Perl Version 1.30, protocol version 2.0. abc123: No compat match: OpenSSH_4.1. abc123: Connection established. abc123: Sent key-exchange init (KEXINIT), wait response. abc123: Algorithms, c->s: 3des-cbc hmac-sha1 none abc123: Algorithms, s->c: 3des-cbc hmac-sha1 none abc123: Entering Diffie-Hellman Group 1 key exchange. abc123: Sent DH public key, waiting for reply. abc123: Received host key, type 'ssh-dss'. abc123: Host 'xyz123' is known and matches the host key. abc123: Computing shared secret key. abc123: Verifying server signature. abc123: Waiting for NEWKEYS message. abc123: Enabling incoming encryption/MAC/compression. abc123: Send NEWKEYS, enable outgoing encryption/MAC/compression. abc123: Sending request for user-authentication service. abc123%
tail of truss output follows..
write(4, "\0\0\0\f\n15C6 DBD V qFB".., 16) = 16 getcontext(0xFFBEF620) amaprd61: Sending request for user-authentication service. write(2, " a m a p r d 6 1 : S e".., 59) = 59 getcontext(0xFFBEF530) getcontext(0xFFBEF388) getcontext(0xFFBEF530) getcontext(0xFFBEF388) write(4, " }C2F0F587A6 ~\n9E a18 =".., 52) Err#32 EPIPE Received signal #13, SIGPIPE [default] *** process killed ***

Replies are listed 'Best First'.
Re: Problem using Net:SSH:Perl
by cosmicperl (Chaplain) on Oct 13, 2007 at 02:41 UTC
    Looks like this isn't authenticating properly. I guess it doesn't like the way you've done:-
    $scon->login($user || $this_user,$pass);
    Try it as a simple if to see if that makes a difference, also print out the $user and $pass to see that the input was picked up properly:-
    print "User:$user\nPass:$pass\n"; if ($user) { $scon->login($user,$pass); } else { $scon->login($this_user,$pass); }


    Lyle
      Lyle Thank you for your time. Appreciate your help. I tried what you suggested, even hardcoding values but no luck. Still fails at the same place. Shown below is the output from truss towards the end of the execution. Any advise please ?
      stat64("/apps/perl/lib/5.6.0/sun4-solaris/Crypt/DSA/Util.pmc", 0xFFBED +978) Err#2 ENOENT open64("/apps/perl/lib/5.6.0/sun4-solaris/Crypt/DSA/Util.pm", O_RDONLY +) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/Crypt/DSA/Util.pmc", 0xFFBED978) Err#2 EN +OENT open64("/apps/perl/lib/5.6.0/Crypt/DSA/Util.pm", O_RDONLY) Err#2 ENOEN +T stat64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Crypt/DSA/Util.pmc +", 0xFFBED978) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Crypt/DSA/Util.pm" +, O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/Crypt/DSA/Util.pmc", 0xFFBED978 +) Err#2 ENOENT ioctl(10, TCGETA, 0xFFBECF74) Err#25 ENOTTY stat64("/apps/perl/lib/5.6.0/sun4-solaris/Math/BigInt/GMP.pmc", 0xFFBE +CD88) Err#2 ENOENT open64("/apps/perl/lib/5.6.0/sun4-solaris/Math/BigInt/GMP.pm", O_RDONL +Y) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/Math/BigInt/GMP.pmc", 0xFFBECD88) Err#2 E +NOENT open64("/apps/perl/lib/5.6.0/Math/BigInt/GMP.pm", O_RDONLY) Err#2 ENOE +NT stat64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Math/BigInt/GMP.pm +c", 0xFFBECD88) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Math/BigInt/GMP.pm +", O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/Math/BigInt/GMP.pmc", 0xFFBECD8 +8) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/Math/BigInt/GMP.pm", O_RDONLY) +Err#2 ENOENT stat64("/apps/perl/lib/site_perl/Math/BigInt/GMP.pmc", 0xFFBECD88) Err +#2 ENOENT open64("/apps/perl/lib/site_perl/Math/BigInt/GMP.pm", O_RDONLY) Err#2 +ENOENT stat64("./Math/BigInt/GMP.pmc", 0xFFBECD88) Err#2 ENOENT open64("./Math/BigInt/GMP.pm", O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/sun4-solaris/Math/BigInt/FastCalc.pmc", 0 +xFFBECD88) Err#2 ENOENT open64("/apps/perl/lib/5.6.0/sun4-solaris/Math/BigInt/FastCalc.pm", O_ +RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/Math/BigInt/FastCalc.pmc", 0xFFBECD88) Er +r#2 ENOENT open64("/apps/perl/lib/5.6.0/Math/BigInt/FastCalc.pm", O_RDONLY) Err#2 + ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Math/BigInt/FastCa +lc.pmc", 0xFFBECD88) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Math/BigInt/FastCa +lc.pm", O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/Math/BigInt/FastCalc.pmc", 0xFF +BECD88) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/Math/BigInt/FastCalc.pm", O_RDO +NLY) Err#2 ENOENT stat64("/apps/perl/lib/site_perl/Math/BigInt/FastCalc.pmc", 0xFFBECD88 +) Err#2 ENOENT open64("/apps/perl/lib/site_perl/Math/BigInt/FastCalc.pm", O_RDONLY) E +rr#2 ENOENT stat64("./Math/BigInt/FastCalc.pmc", 0xFFBECD88) Err#2 ENOENT open64("./Math/BigInt/FastCalc.pm", O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/sun4-solaris/Crypt/DSA/Signature.pmc", 0x +FFBEE5B8) Err#2 ENOENT open64("/apps/perl/lib/5.6.0/sun4-solaris/Crypt/DSA/Signature.pm", O_R +DONLY) Err#2 ENOENT stat64("/apps/perl/lib/5.6.0/Crypt/DSA/Signature.pmc", 0xFFBEE5B8) Err +#2 ENOENT open64("/apps/perl/lib/5.6.0/Crypt/DSA/Signature.pm", O_RDONLY) Err#2 +ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Crypt/DSA/Signatur +e.pmc", 0xFFBEE5B8) Err#2 ENOENT open64("/apps/perl/lib/site_perl/5.6.0/sun4-solaris/Crypt/DSA/Signatur +e.pm", O_RDONLY) Err#2 ENOENT stat64("/apps/perl/lib/site_perl/5.6.0/Crypt/DSA/Signature.pmc", 0xFFB +EE5B8) Err#2 ENOENT ioctl(8, TCGETA, 0xFFBEDBB4) Err#25 ENOTTY ioctl(6, TCGETA, 0xFFBEF6F4) Err#25 ENOTTY write(4, " 6 JA9F087E2 d1E <931EC7".., 52) Err#32 EPIPE