u235sentinel has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH::Perl and Passwd
by helphand (Pilgrim) on Jan 19, 2006 at 03:56 UTC | |
by u235sentinel (Hermit) on Jan 19, 2006 at 05:29 UTC | |
by eldapo (Initiate) on Oct 22, 2008 at 18:52 UTC | |
|
Re: Net::SSH::Perl and Passwd
by samwyse (Scribe) on Aug 19, 2009 at 14:57 UTC | |
by salva (Canon) on Aug 19, 2009 at 18:21 UTC |