Thanks for the reply.
I tried that but adding the utf8::downgrade only made my variable change to '1'.
Here is my code
use Net::SSH::Perl;
use XML::Simple;
do "routines/Log.pm";
my $c_rsync = "$Bin/conf/plugins/rsync.xml";
unless (-e "$c_rsync" ) {
Log ( $l_plugin , "no config file was found, exiting" );
exit;
}
my $xml_conf = eval { XMLin ( $c_rsync , ForceArray => [ 'rsync' ] , K
+eyAttr => {} , KeepRoot => 0 ) };
if ($@) {
Log ( $l_plugin , "failed to load plugin \'rsync\' xml.\nReason: $
+@" );
exit;
}
my ( @rFolder , @rUser , @rIp , @rHome , @rProxy );
foreach (@{ $xml_conf -> {'plugin'} -> {'rsync'} }) {
push ( @rFolder , $_ -> {'loc'} );
push ( @rUser , $_ -> {'uname'} );
push ( @rIp , $_ -> {'ip'} );
push ( @rHome , $_ -> {'fol'} );
if ( defined ( $_ -> {'proxy'} ) ) {
push ( @rProxy , $_ -> {'proxy'} );
} else {
push ( @rProxy , 0 );
}
}
my $cV = 0;
foreach ( @rFolder ) {
my $rSsh = Net::SSH::Perl -> new ( $rIp[$cV] , protocol => '2,1' , ide
+ntity_files => [ "/root/rsync/$rUser[$cV]-rsync-key" ] , debug => 1 )
+;
$rSsh -> login ( $rUser[$cV] );
my ( $oMsg , $oErr , $oExit ) = $rSsh -> cmd ( "du" );
print "$oMsg";
$cV++;
}
exit;
I removed the parts not related to the Net::SSH::Perl stuff.
The code works great when I replace
$rSsh -> login ( $rUser[$cV] );
with
$rSsh -> login ( 'yams-dev' );
and
$rUser[$cV] is definatley giving 'yams-dev' without any newlines on the end or anything odd like that.
This is the debug output I'm getting:
suse-build: Reading configuration data /root/.ssh/config
suse-build: Reading configuration data /etc/ssh_config
suse-build: Allocated local port 1022.
suse-build: Connecting to 87.117.247.76, port 22.
suse-build: Remote protocol version 1.99, remote software version Open
+SSH_3.4p1
suse-build: Net::SSH::Perl Version 1.34, protocol version 2.0.
suse-build: No compat match: OpenSSH_3.4p1.
suse-build: Connection established.
suse-build: Sent key-exchange init (KEXINIT), wait response.
suse-build: Algorithms, c->s: 3des-cbc hmac-sha1 none
suse-build: Algorithms, s->c: 3des-cbc hmac-sha1 none
suse-build: Entering Diffie-Hellman Group 1 key exchange.
suse-build: Sent DH public key, waiting for reply.
suse-build: Received host key, type 'ssh-dss'.
suse-build: Host '87.117.247.76' is known and matches the host key.
suse-build: Computing shared secret key.
suse-build: Verifying server signature.
suse-build:/home/matt/rsync # perl rsync.pm
suse-build: Waiting for NEWKEYS message.
suse-build: Send NEWKEYS.
suse-build: Enabling encryption/MAC/compression.
suse-build: Sending request for user-authentication service.
suse-build: Service accepted: ssh-userauth.
suse-build: Trying empty user-authentication request.
input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.8/i586-linu
+x-thread-multi/Crypt/DES.pm line 56.