Perl远程写文件连接报错Net::SFTP::Foreign

标签 perl ssh sftp perl-module ssh-keys

当我手动运行这个 Perl 脚本时,它可以建立连接。但是当我实现到系统中时,它会显示:authenticity of the target host can't be established, the remote host public key is probably not present on the '~/.ssh/known_hosts' file .

我需要这方面的帮助和建议。

my $host = "xxxs.com";
my $sftp = Net::SFTP::Foreign->new($host,user => 'xxx', password => 'xxx',
                                   more => '-v',stderr_fh => $ssherr);

最佳答案

看看FAQ在 Net::SFTP::Foreign 文档中。它在 下归档主机 key 检查 并且是最后一个条目。这是一个摘录。

Host key checking

Q: Connecting to a remote server with password authentication fails with the following error:

The authenticity of the target host can not be established,
connect from the command line first

A: That probably means that the public key from the remote server is not stored in the ~/.ssh/known_hosts file. Run an SSH Connection from the command line as the same user as the script and answer yes when asked to confirm the key supplied.



那里也有一个例子。

关于Perl远程写文件连接报错Net::SFTP::Foreign,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11113889/

相关文章:

xml - 如何将 XML::Simple 与可能具有一个或多个子元素的 XML 标记一起使用?

linux - 解压文件而不使用第一个目录

ruby-on-rails - 使用私钥和公钥的 API 身份验证

ssh - 当我在 ssh 上收到 'Broken Pipe' 错误时,EC2 实例中的进程会发生什么?

python - Paramiko 关闭连接不起作用

python - 为什么这个 python 代码在导入/编译时挂起但在 shell 中工作?

css - 远程 FTP 站点的实时代码同步?

perl - 逐行打印

MySQL插入创建多行

amazon-ec2 - Packer 将私钥存储在哪里?