CPAN::Forum
Net-SSH-Perl - Connecting to a remote server via net-ssh-perl fails
| Posted on Thu Oct 11 18:22:56 2007 by galaxy123 |
| Connecting to a remote server via net-ssh-perl fails |
|
Hi
We are trying to connect to a remote solaris host via perl program and excute a command
from a sun solaris box. The program just terminates with no error messgaes, any advise for
the community will be helpful...
The code snippet is as shown 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";
***********
As you see in the output it just drops/quits after "Sending request for user-authentication service." message.
The output from a run is as shown below
**********
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%
**********
And the packages that i have installed on the host from which i am invoking the program are
application ACpDgsHMA Perl Module Digest-HMAC-1.01 for Perl v560 Solaris SunOS 5.8
application ACpDgsMD5 Perl Module Digest-MD5-2.36 for Perl v560 Solaris SunOS 5.8
application ACpDgsSHA Perl Module Digest-SHA1-2.11 for Perl v560 Solaris SunOS 5.8
application ACpMthBgI Perl Module Math-BigInt-1.77 for Perl v560 Solaris SunOS 5.8
application ACpMthPr Perl Module Math-Pari-2.010703 for Perl v560 Solaris SunOS 5.8
application ACpNetSSH Perl Module Net::SSH:Perl for Perl v560 Solaris 8
application ACpScLtUt Perl Module Scalar-List-Utils-1.18 for Perl v560 Solaris SunOS 5.8
application ACperl56 Perl 5.6
|
| Direct Responses: 6242 | Write a response |
(9)
]