【发布时间】:2016-08-21 16:48:09
【问题描述】:
我正在尝试使用Net::OpenSSH 的scp_put 函数将文件SCP 到远程机器中。每次运行时,我都会收到以下错误:
scp failed: scp failed: child exited with code 1 at copy_certs.pl line 32.
这是我尝试此操作的代码 sn-p:
use Net::SSH::Perl;
use Exporter;
use Net::OpenSSH;
my $user = "hello";
my $pass = "hello";
my $remote_path = "/hello_folder/ssl";
$host="10.221.33.4";
my $ssh = Net::OpenSSH->new($host, user => $user, password => $pass, master_opts => [-o => "StrictHostKeyChecking=no"]);
$key_file = "certs/mykey.key";
$ssh->scp_put($key_file, $remote_path)
or die "scp failed: " . $ssh->error;
当我手动执行此操作时,我没有任何权限问题。我哪里错了?
【问题讨论】:
-
启用调试
$Net::OpenSSH::debug=-1并在此处附加输出。它将向我们展示模块在后台运行的命令。