perl - Net::SSH::Perl 中的 SSH 连接超时

标签 perl ssh timeout

我正在使用 Net::SSH::Perl 连接到远程服务器并执行命令。问题是即使远程服务器长时间没有响应,它也不会超时。我在 Net::SSH::Perl 中找不到任何超时选项。

任何帮助实现超时表示赞赏。

注:我无权修改Net/SSH/Perl.pm

最佳答案

使用 ConnectTimeout选项。

样本:

use Net::SSH::Perl;

my %params = ( protocol => "2,1",
                identity_files => ["/home/user/.ssh/test_id_dsa"],
                options => [    "BatchMode yes",
                                "ConnectTimeout 3",
                                "StrictHostKeyChecking no"],
                debug => 'true'
);

另见:Net::SSH::Perl ConnectTimeout (ssh -o option)

关于perl - Net::SSH::Perl 中的 SSH 连接超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25543180/

相关文章:

perl - 为什么会出现此错误?

perl - 是否可以在 Perl 中嵌套关联数组

python - 使用结构运行子进程时出现 EOFError

GitHub SSH 配置 : "Bad configuration option: IdentifyFile"

java - Hadoop 总是以 java.util.concurrent.TimeoutException 结束

linux - 如何检测perl脚本中的 "network idle"情况?

python - 如何从脚本语言调用 DLL?

matlab - X11 MATLAB显示图

ios - AFNetworking 超时

java - 在套接字上设置超时时出现 NoSuchElementException