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