Hi Experts,

  I need to use "Net-SSH-W32Perl" package for the work I am doing. This is a
high priority
  task for me. I have a problem with respect to the SSH package. I am using
Win2000 in my PC
  and I need to get the data from the remote unix machine.

  I have written small program as follows.

<snip>


use strict;
use warnings;

use IPC::open2;
use Net::SSH::W32Perl;

#my $host = 'samra.india.hp.com';
my $host  = '15.76.97.101';
my $cmd="ls -al";
my $ssh = new Net::SSH::W32Perl($host,  port => 22, debug => 1, protocol =>
2);

#close(0);
#close(1);
#close(2);

#open(DATF, ">test_ssh");

$ssh->login("Rishi", "Rishi");

#print "Hello \n", $str;


#$ssh->cmd("exit");
 my ($out, $err, $exit) = $ssh->cmd($cmd);
 print "x\n";
 print "y";

 print "\n $out";

;
 $ssh->cmd("cd Perl");
 print "Processes\n";
 my ($out1, $err1, $exit1) = $ssh->cmd("pwd");
 print "\n $out1";

#$ssh->_disconnect();

print "\n Hi Rishi, you are disconnected";
#$ssh->cmd("exit");

</snip>

The current working directory remains as " /home/Rishi". I would like
to get the o/p of "ls -al" from the directory "/home/Rishi/Perl"
dynamically.
I would like the old command
state to be maintained as per my requirements of the project. Can you please
let me know what I
need to do so that I can send commands with respect to my previous command.

Thanks for your help,

Regards,
Rishi


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Chris Purcell
> Sent: Wednesday, May 12, 2004 10:14 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: Net::SSH::W32Perl
>
>
>
> > Hi,
> >
> > Using the following code I continually get an "Invalid
> Arguement" error
> > on the "new" call.  Everywhere I look shows the same syntax.  ANy
> > thoughts?
> >
> > use Net::SSH::W32Perl;
> >
> > my $host = "\\\\at_riscmqit01";
> > my $ssh = new Net::SSH::W32Perl($host);
> > $ssh->login('user','pass');
> >
>
> Change....
>
> my $host = "\\\\at_riscmqit01";
>
> ...to an IP address...
>
> my $host = '192.168.1.1';
>
> Chris
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to