2
我正在尝试使用Net::OpenSSH
的scp_put
函数将SCP文件导入远程机器。每次我跑,我得到以下错误:Perl:权限被net :: OpenSSH的scp_put拒绝
scp failed: scp failed: child exited with code 1 at copy_certs.pl line 32.
这是代码片段,我尝试这样操作:
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'并在此附上输出。它会向我们展示模块在引擎盖下运行的命令。 – salva