Subject: | $ssh->cmd() exec error,prompt sh:onstat : not found |
when i use $ssh->cmd("onstat -m"),it prompt: 'sh:onstat: not found'
my version
1.perl 5.8.8
2.Net:SSH:perl 1.34
3.ssh2.pm v 1.47
4.connet hp-unix's ssh server
my source code is:
my $ssh =Net::SSH::Perl->new( $ip,protocol
=> '2',use_pty=>1,interactive=>1);
$ssh->login($user, $passwd,0);
my ($out1,$err1,$exit1)= $ssh->cmd("onstat -m");
if($out1){print $out1;}
if($err1){print $err1;}
the debug is :
boco-0lqhnvfovr: Reading configuration data /etc/ssh_config
boco-0lqhnvfovr: Connecting to 10.215.51.1, port 22.
boco-0lqhnvfovr: Remote protocol version 2.0, remote software version
OpenSSH_4.
3p2-hpn
boco-0lqhnvfovr: Net::SSH::Perl Version 1.34, protocol version 2.0.
boco-0lqhnvfovr: No compat match: OpenSSH_4.3p2-hpn.
boco-0lqhnvfovr: Connection established.
boco-0lqhnvfovr: Sent key-exchange init (KEXINIT), wait response.
boco-0lqhnvfovr: Algorithms, c->s: 3des-cbc hmac-sha1 none
boco-0lqhnvfovr: Algorithms, s->c: 3des-cbc hmac-sha1 none
boco-0lqhnvfovr: Entering Diffie-Hellman Group 1 key exchange.
boco-0lqhnvfovr: Sent DH public key, waiting for reply.
boco-0lqhnvfovr: Received host key, type 'ssh-dss'.
boco-0lqhnvfovr: Host '10.215.51.1' is known and matches the host key.
boco-0lqhnvfovr: Computing shared secret key.
boco-0lqhnvfovr: Verifying server signature.
boco-0lqhnvfovr: Waiting for NEWKEYS message.
boco-0lqhnvfovr: Send NEWKEYS.
boco-0lqhnvfovr: Enabling encryption/MAC/compression.
boco-0lqhnvfovr: Sending request for user-authentication service.
boco-0lqhnvfovr: Service accepted: ssh-userauth.
boco-0lqhnvfovr: Trying empty user-authentication request.
boco-0lqhnvfovr: Authentication methods that can continue:
publickey,password,ke
yboard-interactive.
boco-0lqhnvfovr: Next method to try is publickey.
boco-0lqhnvfovr: Next method to try is password.
boco-0lqhnvfovr: Trying password authentication.
boco-0lqhnvfovr: Login completed, opening dummy shell channel.
boco-0lqhnvfovr: channel 0: new [client-session]
boco-0lqhnvfovr: Requesting channel_open for channel 0.
boco-0lqhnvfovr: channel 0: open confirm rwindow 0 rmax 32768
boco-0lqhnvfovr: Got channel open confirmation, requesting shell.
boco-0lqhnvfovr: Requesting service shell on channel 0.
boco-0lqhnvfovr: channel 1: new [client-session]
boco-0lqhnvfovr: Requesting channel_open for channel 1.
boco-0lqhnvfovr: Entering interactive session.
boco-0lqhnvfovr: Sending command: onstat -m
boco-0lqhnvfovr: Requesting service pty-req on channel 1.
boco-0lqhnvfovr: Sending command: onstat -m
boco-0lqhnvfovr: Requesting service exec on channel 1.
boco-0lqhnvfovr: channel 1: open confirm rwindow 0 rmax 32768
boco-0lqhnvfovr: channel 1: rcvd eof
boco-0lqhnvfovr: channel 1: output open -> drain
boco-0lqhnvfovr: input_channel_request: rtype exit-status reply 0
boco-0lqhnvfovr: channel 1: rcvd close
boco-0lqhnvfovr: channel 1: input open -> closed
boco-0lqhnvfovr: channel 1: close_read
boco-0lqhnvfovr: channel 1: obuf empty
boco-0lqhnvfovr: channel 1: output drain -> closed
boco-0lqhnvfovr: channel 1: close_write
boco-0lqhnvfovr: channel 1: send close
boco-0lqhnvfovr: channel 1: full closed
sh: onstat: not found.
If i use $ssh->shell (with interactive prompt), it exec successfully
and return report.
best wishes.
help.