SPUG: Reg SSH Packet

Reddy V, Ravinder (Ravinder) ravir at lucent.com
Thu Mar 17 06:37:24 PST 2005


Hi All,

=======================
 #! /usr/bin/perl -w
use Net::SSH::Perl;
use Net::SSH::Perl::Packet;
use Net::SSH::Perl::Constants qw( :msg PROTOCOL_SSH1 );
use IO::Select;

eval {
    my $ssh = Net::SSH::Perl->new("135.254.251.56",port=>22);
    #my($stdout, $stderr, $exit) = $ssh->cmd("ls");
    my $pack = Net::SSH::Perl::Packet->new( $ssh, type => SSH_CMSG_USER ); 
    $pack->put_str("ls");
    $pack->send;
    $pack = Net::SSH::Perl::Packet->read_expect($ssh,2 );     
    print $pack->get_str;
    }; 
        if ($@) {
     print "$@";
        }
================================

 The above perl script should execute the command "ls" remote machine and
should display on the local shell. 
Can anyone please let me know what is the problem in the above script. 

regards,
ravinder


More information about the spug-list mailing list