Hi,

I installed Net::SCP as I was reminded of the module in a recent post.

I need to copy files from one server to another. I generated ssh-keys
for a user and I can use

scp  test.txt myserver:/home/somedude/mytest.txt

without passwords when I su to that user but when I run the script as
myself it doesn't work.

# $DEBUG = 1;
scp /home/somedude/fo.txt [EMAIL PROTECTED]:/home/images/my170px.jpg
256  lost connection


Is this behaviour by design? The script was meant to run as the httpd
user. Is it recommended to set-up ssh-keys for that account? That
account is set with nologin. I think I would have to enable it to make
the scp work. I can't imagine that's recommended! Should I be thinking
about another route for this?

Thanx and sorry if I have strayed OT.
Dp.

#!/usr/local/bin/perl

use Net::SCP (scp);
use strict;
use warnings;

my $file = 'fo.txt';

my $scp = Net::SCP->new("myserver");
$scp->login('somedude') or warn $?, "  ", $scp->{errstr};
$scp->put($file,$remote) or warn $?, "  ", $scp->{errstr};
$scp->quit;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to