Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problem with Net::SSH::W32Perl;

Reply
Thread Tools

problem with Net::SSH::W32Perl;

 
 
Mike Solomon
Guest
Posts: n/a
 
      09-20-2004
I am trying to use Net::SSH::W32Perl;

I wrote the following test script

use strict;

my $host = 'myhost';
my $user = 'user';
my $pass = 'password';
my $cmd = 'ls';

use Net::SSH::W32Perl;

my ($ssh, $out, $err, $exit);

my %args;
$args{debug} = 1;
$args{protocol} = 2;

$ssh = new Net::SSH::W32Perl($host, %args);
$ssh->login($user, $pass);

($out, $err, $exit) = $ssh->cmd("ls");

print "OUT: [$out]\n";
print "ERR: [$err]\n";
print "EXIT: [$exit]\n";

the screen gives the following output then hangs

mjstecra: Reading configuration data /.ssh/config
mjstecra: Reading configuration data /etc/ssh_config
mjstecra: Connecting to myhost, port 22.
mjstecra: Socket created, turning on blocking...
mjstecra: Remote protocol version 1.99, remote software version
OpenSSH_3.5p1 FreeBSD-20030201
mjstecra: Net::SSH:erl Version 1.25, protocol version 2.0.
mjstecra: No compat match: OpenSSH_3.5p1 FreeBSD-20030201.
mjstecra: Connection established.
mjstecra: Sent key-exchange init (KEXINIT), wait response.
mjstecra: Algorithms, c->s: 3des-cbc hmac-sha1 none
mjstecra: Algorithms, s->c: 3des-cbc hmac-sha1 none
mjstecra: Entering Diffie-Hellman Group 1 key exchange.
mjstecra: Sent DH public key, waiting for reply.
mjstecra: Received host key, type 'ssh-dss'.
mjstecra: Host 'newred.gradwell.net' is known and matches the host
key.
mjstecra: Computing shared secret key.
mjstecra: Verifying server signature.
mjstecra: Waiting for NEWKEYS message.
mjstecra: Enabling incoming encryption/MAC/compression.
mjstecra: Send NEWKEYS, enable outgoing encryption/MAC/compression.
mjstecra: Sending request for user-authentication service.
mjstecra: Service accepted: ssh-userauth.
mjstecra: Trying empty user-authentication request.
mjstecra: Authentication methods that can continue:
publickey,password,keyboard-interactive.
mjstecra: Next method to try is publickey.
mjstecra: Next method to try is password.
mjstecra: Trying password authentication.
mjstecra: Login completed, opening dummy shell channel.
mjstecra: channel 0: new [client-session]
mjstecra: Requesting channel_open for channel 0.
mjstecra: channel 0: open confirm rwindow 0 rmax 32768
mjstecra: Got channel open confirmation, requesting shell.
mjstecra: Requesting service shell on channel 0.
mjstecra: channel 1: new [client-session]
mjstecra: Requesting channel_open for channel 1.
mjstecra: Entering interactive session.
mjstecra: Sending command: ls
mjstecra: Requesting service exec on channel 1.
mjstecra: channel 1: send eof
mjstecra: channel 1: open confirm rwindow 131070 rmax 32768
mjstecra: input_channel_request: rtype exit-status reply 0
mjstecra: channel 1: rcvd eof
mjstecra: channel 1: output open -> drain
mjstecra: channel 1: rcvd close

Has anyone got any idea how I can make this work
 
Reply With Quote
 
 
 
 
Mike Solomon
Guest
Posts: n/a
 
      09-21-2004
(Mike Solomon) wrote in message news:<. com>...
> I am trying to use Net::SSH::W32Perl;
>
> I wrote the following test script
>
> use strict;
>
> my $host = 'myhost';
> my $user = 'user';
> my $pass = 'password';
> my $cmd = 'ls';
>
> use Net::SSH::W32Perl;
>
> my ($ssh, $out, $err, $exit);
>
> my %args;
> $args{debug} = 1;
> $args{protocol} = 2;
>
> $ssh = new Net::SSH::W32Perl($host, %args);
> $ssh->login($user, $pass);
>
> ($out, $err, $exit) = $ssh->cmd("ls");
>
> print "OUT: [$out]\n";
> print "ERR: [$err]\n";
> print "EXIT: [$exit]\n";
>
> the screen gives the following output then hangs
>

snip

I solved it

Doing a bit of research I found that the command needs a "\n" and
mustnt put any out put to screen

so the following works

my $host = 'myhost';
my $user = 'user';
my $pass = 'password';

use Net::SSH::W32Perl;

my ($ssh, $out, $err, $exit);

my %args;
$args{debug} = 1;
$args{protocol} = 2;

$ssh = new Net::SSH::W32Perl($host, %args);
$ssh->login($user, $pass);
($out, $err, $exit) = $ssh->cmd('ls > mike.txt',"\n");
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments