the code runs fine if I put a command such as 'ls' or 'hostname' (for example) in variable $cmd. If I put 'passwd' then the register_trigger for stderr comes back with the following error message#!/usr/bin/perl use warnings; use strict; use Net::SSH::Perl; my $srvr = "testserver"; my $username = "test"; my $oldpasswd = "test"; my ($stdout, $stderr, $exit); my $cmd = ('passwd'); my $ssh = Net::SSH::Perl->new($srvr, protocol => 2, debug => 1); $ssh->register_handler("stderr", sub { my($channel, $buffer) = @_; print "** Standard Error - I received this:\n", $buffe +r->bytes; }); # This trigger works perfectly # $ssh->register_handler("stdout", sub { my($channel, $buffer) = @_; print "** Standard Out - I received this:\n", $buffer- +>bytes; }); $ssh->login($username, $oldpasswd); $ssh->cmd($cmd); print "** Ran Command ". $cmd ."\n";
chqpvul8108: channel 1: new client-session chqpvul8108: Requesting channel_open for channel 1. chqpvul8108: Entering interactive session. chqpvul8108: Sending command: passwd chqpvul8108: Requesting service exec on channel 1. chqpvul8108: channel 1: open confirm rwindow 0 rmax 16384 chqpvul8108: channel 1: rcvd eof chqpvul8108: channel 1: output open -> drain chqpvul8108: input_channel_request: rtype exit-status reply 0 chqpvul8108: channel 1: rcvd close chqpvul8108: channel 1: input open -> closed chqpvul8108: channel 1: close_read ** Standard Error - I received this: Unexpected failure. Password file/table unchanged. chqpvul8108: channel 1: obuf empty chqpvul8108: channel 1: output drain -> closed chqpvul8108: channel 1: close_write chqpvul8108: channel 1: send close chqpvul8108: channel 1: full closed ** Ran Command passwd
In reply to Net::SSH::Perl and Passwd by u235sentinel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |